Language.Haskell.Parser and layout rules

Mirko Rahn rahn at ira.uka.de
Fri Feb 18 11:31:01 EST 2005


> The Report (section 9.3, especially notes 1 and 2) says "A nested context
> must be further indented than the enclosing context", ...

Okay, I understand, but the behavoir of hugs vs ghc vs 
Language.Haskell.Parser is still strange: The sniplets

** A:
g xs = do ys <- workM xs
           if null ys then return [] else do
           zs <- workM ys
           return zs

** B:
g xs = do ys <- workM xs
           if null ys then return [] else do
           zs <- workM ys
            return zs

** C:
f xs = case xs of
          y:ys -> case ys of
          z:zs -> zs

** D:
f x = case x of
          False -> do
     { return x; }

are accepted by
                                       A    B    C   D
ghc                                   yes  no   no  yes
hugs                                  yes  no   no  no
Language.Haskell.Parser.parseModule   no   yes  yes no
report                                no   no   no  no

It seems to me that the layout rule is incorrect implemented everywhere...

regards,

-- 
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---


More information about the Libraries mailing list