Open tfausak opened 4 years ago
Thanks for the report, need to keep track of this.
I have thought about this briefly before, and I thought we'd be able to transform it into do
's variant of let
(the one without in
). But that does not work in general, because you can have recursive bindings:
main = do
let { x = 1 : y ; y = 2 : x } in print (take 10 x)
-- perfectly valid but
main = do
let x = 1 : y -- kaboom
let y = 1 : x
print (take 10 x)
So your last suggestion is the only working solution I think.
Alternatively you may be able to drop the in
, although that might lead to weird scoping problems.
main = do
let one = 1
two = 2
print ( one + two )
Given the following input:
Brittany (version 0.12.1.1) fails and produces this output:
If there's only one binder in the
let
and it's short enough, Brittany produces output that works:GHC is fine with
let ... in ...
insidedo
notation as long as everything after thelet
is indented enough. It's possible to format the first example using layout like so: