Shorted the definition of generateMapping in ArrayUsageCheckTest

This commit is contained in:
Neil Brown 2008-02-06 23:55:01 +00:00
parent 4299951511
commit 74d5bc675d

View File

@ -564,11 +564,7 @@ testIndexes = TestList
-- from one to the indexes of the next. If any of the keys in the map don't match
-- (i.e. if (keys m0 /= keys m1)) Nothing will be returned
generateMapping :: VarMap -> VarMap -> Maybe [(CoeffIndex,CoeffIndex)]
generateMapping m0 m1 = if Map.keys m0 /= Map.keys m1 then Nothing else Just (Map.elems $ zipMap f m0 m1)
where
f (Just x) (Just y) = Just (x,y)
f _ _ = Nothing
-- More readable than liftM (,) !
generateMapping m0 m1 = if Map.keys m0 /= Map.keys m1 then Nothing else Just (Map.elems $ zipMap mergeMaybe m0 m1)
-- | Given a forward mapping list, translates equations across
translateEquations :: [(CoeffIndex,CoeffIndex)] -> (EqualityProblem, InequalityProblem) -> IO (Maybe (EqualityProblem, InequalityProblem))