Repository : ssh://darcs.haskell.org//srv/darcs/packages/base On branch : master
http://hackage.haskell.org/trac/ghc/changeset/2ceacbc35d9c5f4bc6cbcfa46f64d333f9dc53c7 >--------------------------------------------------------------- commit 2ceacbc35d9c5f4bc6cbcfa46f64d333f9dc53c7 Author: George Giorgidze <[email protected]> Date: Mon Jul 4 21:01:12 2011 +0200 Move the munzip function in the Zip type class; >--------------------------------------------------------------- Control/Monad/Zip.hs | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Control/Monad/Zip.hs b/Control/Monad/Zip.hs index 8c431bd..9d71a53 100644 --- a/Control/Monad/Zip.hs +++ b/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 : [email protected] @@ -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 _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
