Jan-Willem Maessen writes:
> We were quite surprised when a student mnaged to get away with the
> following (skeletal) definition:
> 
> sumsquares n | n < 0  = error "sumsquares:n < 0"
>            n | n >= 0 = n

This is a nice example of obfuscated (but legal) Haskell.  It is the
same as

  sumsquares n | n < 0  = error "sumsquares:n < 0" n
               | n >= 0 = n

Note that no layout rule applies here.  So it is also no wonder that
other haskell parsers accept it as well.  It works because the type of
error is absolutely unrestricted.

Heribert.


PS: Or was this meant as a puzzle and I have spoiled it now for the
others?

Reply via email to