Syntax extensions: mdo and do...rec

Iavor Diatchki diatchki at cse.ogi.edu
Wed Sep 17 11:41:05 EDT 2003


hello,

i have no strong feelings about that either way,
however since in haskell we do not have "let" vs "let rec" distinctions,
perhaps we should not have "do" vs "do rec" distinction.
this of course would break programs relying on shadowing
(and at least i write quite a few of those, but that is mostly habit).
i doubt that this will cause many backward compatability problems,
as one can compile old modules (not using recursive do) without
the flag enabling recursive dos.

bye
iavor





Simon Peyton-Jones wrote:
> I agree with this. We'll move GHC to implement any consensus.
> 
> My own opinion is that
> 	expr :: = ... | do { stmts }
> 
> 	stmts :: = .. | rec { stmts }
> 
> is the cleanest story.  I guess that we should ensure that
> 
> 	do rec { stmts }
> 
> means what it looks like.
> 
> Simon
> 
> | -----Original Message-----
> | From: haskell-bounces at haskell.org [mailto:haskell-bounces at haskell.org]
> On Behalf Of
> | nilsson at cs.yale.edu
> | Sent: 16 September 2003 18:09
> | To: haskell at haskell.org
> | Subject: Syntax extensions: mdo and do...rec
> | 
> | Dear Haskellers,
> | 
> | A questions.
> | 
> | The do-notation has been extended to support recursive bindings by
> using
> | the "mdo" keyword. The do-notation has also been extended (through
> Ross
> | Patterson's preprocessor, and now also GHC) to support programming
> | with arrows. In that context, a different syntax, using the keyword
> "rec",
> | is used to enable recursive bindings.
> | 
> | It seems somewhat confusing to have distinct syntax for what appears
> | to be very closely related purposes. Would it be possible have just a
> | single syntactic extension to enable recursive bindings in either
> context?
> | (Presumably the "rec" version is a bit more flexible in that it can be
> | applied to a subset of the bindings in a do-construct.)
> | 
> | Best regards,
> | 
> | /Henrik
> | 
> | --
> | Henrik Nilsson
> | Yale University
> | Department of Computer Science
> | nilsson at cs.yale.edu
> | _______________________________________________
> | Haskell mailing list
> | Haskell at haskell.org
> | http://www.haskell.org/mailman/listinfo/haskell
> 
> 
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
> 


-- 
==================================================
| Iavor S. Diatchki, Ph.D. student               |
| Department of Computer Science and Engineering |
| School of OGI at OHSU                          |
| http://www.cse.ogi.edu/~diatchki               |
==================================================



More information about the Haskell mailing list