michael rice wrote:
OK, then there's also an implicit *in* after the *let* in this code. Must the 
implicit (or explicit) *in* actually use the calculated value(s)?

And, the monad can "continue on" after the *let* (with or without the *in*) as 
below, i.e., the *let* needn't be the last statement in the *do*?



More specifically, there is an implicit "in do". So given some code,

    foo = do
        something
        let x = bar
            y = baz
        thingsome
        somesome

First there's the insertion of braces and semicolons implied by the layout rules.

    foo = do
        { something
        ; let { x = bar
              ; y = baz
        }; thingsome
        ; somesome
        }

Then we desugar the let-do notation,

    foo = do
        { something
        ; let { x = bar
              ; y = baz
        } in do
        { thingsome
        ; somesome
        }}

Or with prettier typesetting,

    foo = do
        { something
        ; let
            { x = bar
            ; y = baz
          } in do
            { thingsome
            ; somesome
            }
        }

and finally we can desugar do notation into (>>=), (>>), and fail.

--
Live well,
~wren
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to