[Haskell-cafe] Parse error

Evan Laforge qdunkan at gmail.com
Mon Jan 18 03:53:31 EST 2010


> It's an improvement. It's still not pretty, but I guess that's as good as
> it's going to get...
>
> Maybe this is an instance of Haskell trying to tell me "if you need to write
> a 20-line do-block in the middle of your function, you're doing it wrong".

20 lines is a lot, but I have smaller ones all the time.  You need >4
spaces of indent to continue a let.  Here's another way to understand
why:

f = do
    let x = some big
            expression
        y = another big
            expression
    x y

If you wonder why "multiple let" syntax is needed, well I don't really
know for sure, but consider if x and y were mutually recursive.

I was annoyed at first with all the indentation but got used to it.  I
use 4 space indents so it works out ok.  Binding with <- or in where
can reduce the indentation but is not always appropriate.


More information about the Haskell-Cafe mailing list