Wed Oct 28 06:35:54 PDT 2009 [email protected]
* Add 'rec' to stmts in a 'do', and deprecate 'mdo'
Ignore-this: 7b77848c6283828869783ed61510ee1c
The change is this (see Trac #2798). Instead of writing
mdo { a <- getChar
; b <- f c
; c <- g b
; putChar c
; return b }
you would write
do { a <- getChar
; rec { b <- f c
; c <- g b }
; putChar c
; return b }
That is,
* 'mdo' is eliminated
* 'rec' is added, which groups a bunch of statements
into a single recursive statement
This 'rec' thing is already present for the arrow notation, so it
makes the two more uniform. Moreover, 'rec' lets you say more
precisely where the recursion is (if you want to), whereas 'mdo' just
says "there's recursion here somewhere". Lastly, all this works with
rebindable syntax (which mdo does not).
Currently 'mdo' is enabled by -XRecursiveDo. So we now deprecate this
flag, with another flag -XDoRec to enable the 'rec' keyword.
Implementation notes:
* Some changes in Lexer.x
* All uses of RecStmt now use record syntax
I'm still not really happy with the "rec_ids" and "later_ids" in the
RecStmt constructor, but I don't dare change it without consulting Ross
about the consequences for arrow syntax.
M ./compiler/deSugar/Coverage.lhs -7 +9
M ./compiler/deSugar/DsArrows.lhs -1 +3
M ./compiler/deSugar/DsExpr.lhs -18 +52
M ./compiler/hsSyn/HsExpr.lhs -21 +51
M ./compiler/hsSyn/HsUtils.lhs -4 +12
M ./compiler/main/DynFlags.hs -3 +6
M ./compiler/parser/Lexer.x -1 +5
M ./compiler/rename/RnExpr.lhs -94 +92
M ./compiler/typecheck/TcExpr.lhs-boot -1 +1
M ./compiler/typecheck/TcHsSyn.lhs -13 +18
M ./compiler/typecheck/TcMatches.lhs -24 +87
M ./docs/users_guide/glasgow_exts.xml -35 +63
View patch online:
http://darcs.haskell.org/ghc-6.12/ghc/_darcs/patches/20091028133554-1287e-5ae737a3257fbb45576bc074a465b89d665f5f64.gz
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc