Out of interest, without trying it, what do you think this program
should print (the only difference between the 3 functions is the
indentation of the "where" line)?:

main = do print $ f1 1
        print $ f2 1
        print $ f3 1

I reckon it would be "layout error" at line 2.  :-)

f1 x = x + case () of
         () -> x
       where x = 5

To be honest, it goes slightly against my intuition that the pattern- match against () is accepted by the layout rule at all, because it is indented further to the left than the case itself. Landin's original rule was something like "everything strictly to the right and below" belongs to the syntactic construct. This example breaks that principle.

Regards,
   Malcolm

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to