This is a request for an adjustment of the syntax for the new recursive do notation. "rec { ... }" should parse/type check as an expression such that:

mdo a <- getChar b <- f c c <- g b putChar c return b

can be written as

do rec a <- getChar b <- f c c <- g b putChar c return b

at moment the closest you can get is ...

t5 = do rec a <- getChar b <- f c c <- g b putChar c return b

it seems rec { ... } is a binding construct not an expression and therefore can not be used in the final position (or sole component) of a do block

benefits

drop in replacement for mdo, that is the construct "do rec"

becomes semantically and syntactically equivalent to the mdo notation

current layout is maintained (which is much neater)

I would argue that it is more intuitive

dificulty

it seems to be a minor change?.

related

this change seems to have been introduced as

http://hackage.haskell.org/trac/ghc/ticket/2798 somewhat surreptitiously (well, cought me by surprise, anyway.).

background

12.1 introduced a change to the recursive do syntax

http://old.nabble.com/Update-on-GHC-6.12.1-td26103595.html

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

A couple of issues about the change:

the new syntax spoils layout (see above)

migrating to the new syntax with the current limitation is

non-trivial, requires analysis of code (in some cases).

for the record ...

> t2 = > do rec > a <- getChar > b <- f c > c <- g b > putChar c > return b > f = return . (const 'a') > g = return eg.lhs:23:6: The last statement in a 'do' construct must be an expression Failed, modules loaded: none.