Began trying to fix the customVarCompare function in UsageCheck
This commit is contained in:
parent
668ed9531e
commit
ad7b4e9736
|
@ -18,7 +18,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
module UsageCheck (checkPar, customVarCompare, Decl, labelFunctions, ParItems(..), transformParItems, Var(..), Vars(..), vars) where
|
module UsageCheck (checkPar, customVarCompare, Decl, labelFunctions, ParItems(..), transformParItems, Var(..), Vars(..), vars) where
|
||||||
|
|
||||||
import Data.Generics
|
import Data.Generics hiding (GT)
|
||||||
import Data.Graph.Inductive
|
import Data.Graph.Inductive
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
@ -33,9 +33,15 @@ import ShowCode
|
||||||
newtype Var = Var A.Variable deriving (Show)
|
newtype Var = Var A.Variable deriving (Show)
|
||||||
|
|
||||||
|
|
||||||
|
-- Here's the idea for easily building a compare function. Go through in ascending order.
|
||||||
|
-- Match A vs A in detail. For A vs _ give LT. Then match B vs B in detail
|
||||||
|
-- For B vs _ give LT. Repeat until the end, and provide a default case of GT,
|
||||||
|
-- which will catch (_(>A) vs A, _(>B) vs B, etc)
|
||||||
customVarCompare :: A.Variable -> A.Variable -> Ordering
|
customVarCompare :: A.Variable -> A.Variable -> Ordering
|
||||||
customVarCompare (A.Variable _ (A.Name _ _ lname)) (A.Variable _ (A.Name _ _ rname)) = compare lname rname
|
customVarCompare (A.Variable _ (A.Name _ _ lname)) (A.Variable _ (A.Name _ _ rname)) = compare lname rname
|
||||||
-- TODO the rest
|
customVarCompare (A.Variable {}) _ = LT
|
||||||
|
-- TODO the rest (will need an ordering over Expression, yikes!)
|
||||||
|
--customVarCompare _ _ = GT
|
||||||
|
|
||||||
instance Eq Var where
|
instance Eq Var where
|
||||||
a == b = EQ == compare a b
|
a == b = EQ == compare a b
|
||||||
|
|
Loading…
Reference in New Issue
Block a user