Reputation: 6146
Consider the following code:
foo = do
let bar = do
baz
bar
It doesn't parse in ghc
, version 8. It complains about the line containing baz
. This code does parse, though:
foo = do
let bar = do
baz
bar
I find this confusing. What's the essential difference between the two versions?
Upvotes: 1
Views: 288
Reputation: 530823
The problem is the indentation puts baz
in no-mans land. It isn't indented far enough to be part of the let
expression, but it is indented too far to be the next part of the do
expression containing the let
expression.
Upvotes: 4