Syntax extensions: mdo and do...rec

Brandon Michael Moore brandon at its.caltech.edu
Wed Sep 17 18:42:24 EDT 2003


Sorry, I forgot the main question I was raising.

Even if we need something other than mdo, do we need to make a distinction
between do and mdo? If left tightening is satisfied then do and mdo are
equivalent for nonrecursive blocks. If we are willing to give up shadowing
a compiler could translate recursive blocks with mfix and non-recursive
blocks without. Personally I don't like shadowing, and especially don't
like reursive bindings some places and shadowing in others.

On the necessity of rec syntax, how is a statement like
 do rec binds1
    rec binds2
    stmts
different from
 do BV1 <- mdo binds1
               return BV1
    BV2 <- mdo binds2
               return BV2
    stmts
where BVn is a tuple of all the variables bound in bindsn.

Brandon



More information about the Haskell mailing list