#4370: Bring back monad comprehensions
------------------------------+---------------------------------------------
Reporter: simonpj | Owner: simonpj
Type: feature request | Status: patch
Priority: high | Milestone: 7.2.1
Component: Compiler | Version: 6.12.3
Resolution: | Keywords:
Testcase: | Blockedby:
Difficulty: | Os: Unknown/Multiple
Blocking: | Architecture: Unknown/Multiple
Failure: None/Unknown |
------------------------------+---------------------------------------------
Changes (by simonpj):
* owner: => simonpj
Comment:
OK I have applied the munzip change. Ian can you merge? That leaves
George's question still to be attended to.
Simon
{{{
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
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4370#comment:64>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs