[Haskell-cafe] 'let' keyword optional in do notation?
es at ertes.de
Wed Aug 8 17:27:56 CEST 2012
Vo Minh Thu <noteed at gmail.com> wrote:
> This is not a parsing problem, but a scoping one: try to run this
> main = do
> let x = y
> y = 5
> let a = b
> let b = 6
> print (x, y, a, b)
Martijn has actually covered this question:
> > 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 suggestion seems sound to me, and the additional 'let' can really be
annoying in cases where you have a lot of 'let' bindings among very few
monadic actions. My current way to deal with this is to move the stuff
to separate computations, but it's certainly not a nice solution:
myComp = c >>= f
f x = ...
a = ...
b = ...
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: not available
More information about the Haskell-Cafe