Added a new helper function to Utils for joining pairs of lists with pairs of lists

This commit is contained in:
Neil Brown 2009-02-07 18:45:56 +00:00
parent d8b722df89
commit 091acfa848
2 changed files with 5 additions and 1 deletions

View File

@ -418,7 +418,7 @@ makeSingleEq f e desc = (lift (flatten e) >>* f) >>= makeEquation e ([{-TODO-}],
-- | A helper function for joining two problems -- | A helper function for joining two problems
accumProblem :: (EqualityProblem,InequalityProblem) -> (EqualityProblem,InequalityProblem) -> (EqualityProblem,InequalityProblem) accumProblem :: (EqualityProblem,InequalityProblem) -> (EqualityProblem,InequalityProblem) -> (EqualityProblem,InequalityProblem)
accumProblem (a,b) (c,d) = (a ++ c, b ++ d) accumProblem = concatPair
-- | Given a list of (written,read) expressions, an expression representing the upper array bound, returns either an error -- | Given a list of (written,read) expressions, an expression representing the upper array bound, returns either an error

View File

@ -117,6 +117,10 @@ combineCompare (LT:_) = LT
combineCompare (GT:_) = GT combineCompare (GT:_) = GT
combineCompare (EQ:os) = combineCompare os combineCompare (EQ:os) = combineCompare os
-- Takes two pairs of lists, returns a pair with the fsts join and the snds joined
concatPair :: ([a], [b]) -> ([a], [b]) -> ([a], [b])
concatPair a b = (fst a ++ fst b, snd a ++ snd b)
-- | Maps two functions over members of a pair -- | Maps two functions over members of a pair
transformPair :: (x -> a) -> (y -> b) -> (x,y) -> (a,b) transformPair :: (x -> a) -> (y -> b) -> (x,y) -> (a,b)
transformPair f g (x,y) = (f x, g y) transformPair f g (x,y) = (f x, g y)