[Haskell] return?

Wolfgang Lux wlux at uni-muenster.de
Fri Apr 30 21:02:17 EDT 2004

John Meacham wrote:

> you can make things somewhat better with this construct
> foo = do
>         baz
>         if cond then return bar else do
>         bua
>         bam

Except that this is invalid according to the Haskell report. In note 1
in section 9.3 (Layout), the report explicitly states that "A nested
context must be further indented than the enclosing context". While
hugs and ghc incorrectly accept your code, hbc and nhc98 get it right,
i.e., they raise a parse error on it.


More information about the Haskell mailing list