[commit: ghc] ghc-7.2: Fix comments and documentation on monad comprehensions (69eff18)
Ian Lynagh
igloo at earth.li
Thu Jul 28 18:58:14 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : ghc-7.2
http://hackage.haskell.org/trac/ghc/changeset/69eff1883633021a20ab431a2aed5db686138b83
>---------------------------------------------------------------
commit 69eff1883633021a20ab431a2aed5db686138b83
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 35bb17b..0738e4b 100644
--- a/compiler/hsSyn/HsExpr.lhs
+++ b/compiler/hsSyn/HsExpr.lhs
@@ -919,10 +919,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 29c4763..3227692 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