[Haskell-cafe] 'let' keyword optional in do notation?

Martijn Schrage martijn at oblomov.com
Wed Aug 8 17:06:14 CEST 2012

Hi cafe,

For a while now, I've been wondering why the 'let' keyword in a do block 
isn't optional. So instead of

do ...
    let x = exp1
        y = exp2
    z <- exp3

you could simply write

do ...
    x = exp1
    y = exp2
    z <- exp3

Where each sequence of let-less bindings is put in a separate binding 
group. I'm no parsing wizard, but I couldn't come up with any situations 
in which this would cause ambiguity. To me, the let-less version is 
easier on the eyes, more consistent with <- bindings, and also makes it 
less of a hassle to move stuff around.

The above probably also holds for list/monad comprehensions, but the 
explicit let has never really bothered me there.

Martijn Schrage -- Oblomov Systems (http://www.oblomov.com)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120808/debeec68/attachment.htm>

More information about the Haskell-Cafe mailing list