diff --git a/transformations/UsageCheck.hs b/transformations/UsageCheck.hs index 3fda0f0..ea75ab2 100644 --- a/transformations/UsageCheck.hs +++ b/transformations/UsageCheck.hs @@ -18,7 +18,7 @@ with this program. If not, see . 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 qualified Data.Map as Map import Data.Maybe @@ -33,9 +33,15 @@ import ShowCode 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.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 a == b = EQ == compare a b