diff options
author | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2009-03-15 06:57:09 +0000 |
---|---|---|
committer | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2009-03-15 06:57:09 +0000 |
commit | 0ae16401a0c73548ba4c08f588174f618c363a73 (patch) | |
tree | 9c730767be399dffe55a9846a9039c35b504a129 /compiler/utils | |
parent | 4e3542263207ae49963811aeb84927027e7bb61d (diff) | |
download | haskell-0ae16401a0c73548ba4c08f588174f618c363a73.tar.gz |
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.
Diffstat (limited to 'compiler/utils')
-rw-r--r-- | compiler/utils/MonadUtils.hs | 13 |
1 files changed, 12 insertions, 1 deletions
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 ([],[],[]) |