[Haskell-cafe] Couple of questions about *let* within *do*
watkins at alum.rpi.edu
Tue Aug 10 13:42:28 EDT 2010
The let's aren't really statements, they're just named expressions and are still subject to lazy evaluation.
let x = putStrLn "Name" >> getLine
The program will print:
and then prompt for input, even though the let comes first.
And if you never ran the 'x' action, then the user would just see "Welcome" and the block of code would finish (because lazy evaluation still applies).
On Tuesday Aug 10, 2010, at 12:49 PM, Felipe Lessa wrote:
> The (let ... in ...) construct is an expression, while the (let ...)
> inside 'do' is a statement. The (do ...) itself is an expression.
More information about the Haskell-Cafe