[commit: ghc] master: Fix comments and documentation on monad comprehensions (e2ba862)
Simon Peyton Jones
simonpj at microsoft.com
Wed Jul 27 07:58:52 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/e2ba86228445cfe5faeedccb73a3ddea0a3b9026
>---------------------------------------------------------------
commit e2ba86228445cfe5faeedccb73a3ddea0a3b9026
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed Jul 27 06:22:26 2011 +0100
Fix comments and documentation on monad comprehensions
>---------------------------------------------------------------
compiler/hsSyn/HsExpr.lhs | 8 ++++----
docs/users_guide/glasgow_exts.xml | 6 ++++--
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/compiler/hsSyn/HsExpr.lhs b/compiler/hsSyn/HsExpr.lhs
index 4179423..1b556f3 100644
--- a/compiler/hsSyn/HsExpr.lhs
+++ b/compiler/hsSyn/HsExpr.lhs
@@ -944,10 +944,10 @@ data StmtLR idL idR
}
deriving (Data, Typeable)
-data TransForm -- The 'f' below is the 'using' function, 'e' is the by function
- = ThenForm -- then f or then f by e
- | GroupFormU -- group using f or group using f by e
- | GroupFormB -- group by e
+data TransForm -- The 'f' below is the 'using' function, 'e' is the by function
+ = ThenForm -- then f or then f by e (depending on trS_by)
+ | GroupFormU -- group using f or group using f by e (depending on trS_by)
+ | GroupFormB -- group by e
-- In the GroupByFormB, trS_using is filled in with
-- 'groupWith' (list comprehensions) or
-- 'groupM' (monad comprehensions)
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index 77d37c8..8aca42c 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -1382,13 +1382,15 @@ D[ e | (Q | R), S ] = mzip D[ Qv | Q ] D[ Rv | R ] >>= \(Qv,Rv) -> D
-- Transform comprehensions
D[ e | Q then f, R ] = f D[ Qv | Q ] >>= \Qv -> D[ e | R ]
-D[ e | Q then f by b, R ] = f b D[ Qv | Q ] >>= \Qv -> D[ e | R ]
+D[ e | Q then f by b, R ] = f (\Qv -> b) D[ Qv | Q ] >>= \Qv -> D[ e | R ]
D[ e | Q then group using f, R ] = f D[ Qv | Q ] >>= \ys ->
case (fmap selQv1 ys, ..., fmap selQvn ys) of
Qv -> D[ e | R ]
-D[ e | Q then group by b using f, R ] = f b D[ Qv | Q ] >>= \ys ->
+D[ e | Q then group by b, R ] = D[ e | Q then group by b using mgroupWith, R ]
+
+D[ e | Q then group by b using f, R ] = f (\Qv -> b) D[ Qv | Q ] >>= \ys ->
case (fmap selQv1 ys, ..., fmap selQvn ys) of
Qv -> D[ e | R ]
More information about the Cvs-ghc
mailing list