From 0ae16401a0c73548ba4c08f588174f618c363a73 Mon Sep 17 00:00:00 2001 From: Manuel M T Chakravarty Date: Sun, 15 Mar 2009 06:57:09 +0000 Subject: Ensure the orientation of var-var equalities is correct for instatiation - During fianlisation we use to occasionally swivel variable-variable equalities - Now, normalisation ensures that they are always oriented as appropriate for instantation. - Also fixed #1899 properly; the previous fix fixed a symptom, not the cause. --- compiler/utils/MonadUtils.hs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'compiler/utils/MonadUtils.hs') diff --git a/compiler/utils/MonadUtils.hs b/compiler/utils/MonadUtils.hs index 4ddd4eadfc..20646572df 100644 --- a/compiler/utils/MonadUtils.hs +++ b/compiler/utils/MonadUtils.hs @@ -10,7 +10,8 @@ module MonadUtils , MonadIO(..) , liftIO1, liftIO2, liftIO3, liftIO4 - + + , zipWith3M , mapAndUnzipM, mapAndUnzip3M, mapAndUnzip4M , mapAccumLM , mapSndM @@ -78,6 +79,16 @@ liftIO4 = (((.).(.)).((.).(.))) liftIO -- These are used throughout the compiler ---------------------------------------------------------------------------------------- +zipWith3M :: Monad m => (a -> b -> c -> m d) -> [a] -> [b] -> [c] -> m [d] +zipWith3M _ [] _ _ = return [] +zipWith3M _ _ [] _ = return [] +zipWith3M _ _ _ [] = return [] +zipWith3M f (x:xs) (y:ys) (z:zs) + = do { r <- f x y z + ; rs <- zipWith3M f xs ys zs + ; return $ r:rs + } + -- | mapAndUnzipM for triples mapAndUnzip3M :: Monad m => (a -> m (b,c,d)) -> [a] -> m ([b],[c],[d]) mapAndUnzip3M _ [] = return ([],[],[]) -- cgit v1.2.1