[Haskell-beginners] Doubt in let expression
Stephen Tetley
stephen.tetley at gmail.com
Sun Apr 11 04:28:29 EDT 2010
Hello
There is no semantic implication of the difference.
http://haskell.org/onlinereport/syntax-iso.html
The Haskell syntax allows multiple declarations within a single let expression:
exp10 -> ...
| let decls in exp
where decls is a list of declarations, (braces and colons can be
replaced by layout):
decls -> { decl1 ; ... ; decln }
As a let ... in ... is an expression you can choose to write a list of
declarations as nested let instead as you did in the second version.
>From the original description of GHC intermediate form 'core' [1] page
3 shows that GHC chooses to desugar a let expression with a list of
decls into nested singular let expressions, though this might have
changed and also I might be misreading how GHC core distinguishes
recursive let declarations which do appear as lists.
Best wishes
Stephen
[1] An External Representation for the GHC Core Language (DRAFT for GHC5.02)
Andrew Tolmach and the GHC Team
GHC doesn't define Haskell of course...
More information about the Beginners
mailing list