[Fix formatting and wording in documentation of DoRec
simonpj@microsoft.com**20091029114726
Ignore-this: ce528f2e73f38c244be4a38d83f52214
] {
hunk ./docs/users_guide/glasgow_exts.xml 879
-The rec
hunk ./docs/users_guide/glasgow_exts.xml 883
-A recursive do for Haskell,
+A recursive do for Haskell,
hunk ./docs/users_guide/glasgow_exts.xml 896
-which wraps a mutually-recusrive group of monadic statements,
-producing a single statement. Similar to a let
+which wraps a mutually-recursive group of monadic statements,
+producing a single statement.
+
+Similar to a let
hunk ./docs/users_guide/glasgow_exts.xml 902
+For example, compare
+
+do { a <- getChar do { a <- getChar
+ ; let { r1 = f a r2 ; rec { r1 <- f a r2
+ ; r2 = g r1 } ; r2 <- g r1 }
+ ; return (r1 ++ r2) } ; return (r1 ++ r2) }
+
+In both cases, r1 and r2 are
+available both throughout the let or rec block, and
+in the statements that follow it. The difference is that let is non-monadic,
+while rec is monadic. (In Haskell let is
+really letrec, of course.)
hunk ./docs/users_guide/glasgow_exts.xml 930
-In general, a rec statment rec ss
+In general, the statment rec ss
hunk ./docs/users_guide/glasgow_exts.xml 933
- vs <- mfix (\~vs -> do { ss
- ; return vs })
+ vs <- mfix (\~vs -> do { ss; return vs })
hunk ./docs/users_guide/glasgow_exts.xml 935
-where vs is a tuple of the varaibles bound by ss.
+where vs is a tuple of the variables bound by ss.
hunk ./docs/users_guide/glasgow_exts.xml 952
+
+
+
hunk ./docs/users_guide/glasgow_exts.xml 968
-A recursive do for Haskell,
-to break up a single rec statement into a sequenc e of statements with
+A recursive do for Haskell,
+to break up a single rec statement into a sequence of statements with
hunk ./docs/users_guide/glasgow_exts.xml 971
-improves polymorphism, and reduces the size of the recursive "knot".
+improves polymorphism, reduces the size of the recursive "knot", and, as the paper
+describes, also has a semantic effect (unless the monad satisfies the right-shrinking law).
hunk ./docs/users_guide/glasgow_exts.xml 978
-
+ Mdo-notation (deprecated)
}