summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libraries/base/Control/Monad/Zip.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/libraries/base/Control/Monad/Zip.hs b/libraries/base/Control/Monad/Zip.hs
index 8c431bdbfb..9d71a53878 100644
--- a/libraries/base/Control/Monad/Zip.hs
+++ b/libraries/base/Control/Monad/Zip.hs
@@ -3,6 +3,7 @@
-- |
-- Module : Control.Monad.Zip
-- Copyright : (c) Nils Schweinsberg 2011,
+-- (c) George Giorgidze 2011
-- (c) University Tuebingen 2011
-- License : BSD-style (see the file libraries/base/LICENSE)
-- Maintainer : libraries@haskell.org
@@ -40,8 +41,13 @@ class Monad m => MonadZip m where
mzipWith :: (a -> b -> c) -> m a -> m b -> m c
mzipWith f ma mb = liftM (uncurry f) (mzip ma mb)
-instance MonadZip [] where
- mzip = zip
+ munzip :: m (a,b) -> (m a, m b)
+ munzip mab = (liftM fst mab, liftM snd mab)
+ -- munzip is a member of the class because sometimes
+ -- you can implement it more efficiently than the
+ -- above default code. See Trac #4370 comment by giorgidze
-munzip :: MonadZip m => m (a,b) -> (m a, m b)
-munzip mab = (liftM fst mab, liftM snd mab)
+instance MonadZip [] where
+ mzip = zip
+ mzipWith = zipWith
+ munzip = unzip \ No newline at end of file