some bugs in Language.Haskell.Parser

Ross Paterson ross@soi.city.ac.uk
Sun, 13 Jul 2003 12:52:40 +0100


On Sat, Jul 12, 2003 at 03:08:42PM -0700, Hal Daume wrote:
> The program:
> 
> > x = v where v = 2 where
> >
> > main = putStrLn "hello world"
> 
> parses as:
> 
> > x = v 
> >   where v = 2 
> >         main = putStrLn "hello world"
> 
> which is incorrect.
> 
> (in general, the parser can't deal with empty where clauses) as in:
> 
> > x = 'a' where
> > class A a where
> 
> this gives a parse error because it's waiting for a real declaration
> inside of the first where clause.

Thanks for the report.  All these are due to the implementation of layout
omitting the rule about inserting empty braces (now fixed in CVS).

> it also can't deal with empty statements:
> 
> > v = do {return 'a';;}
> 
> should be accepted but results in a parser error.

This isn't Haskell.