
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. it also can't deal with empty statements:
v = do {return 'a';;}
should be accepted but results in a parser error. in Parser.ly, this essentially boils down to the fact that 'decllist' must be nonempty, but in certain circumstances (all?), it really *can* be empty. the last error (with statements), can be fixed by replacing line 637-639:
stmtlist :: { [HsStmt] } : '{' stmts '}' { $2 } | open stmts close { $2 }
with:
stmtlist :: { [HsStmt] } : '{' stmts optsemis '}' { $2 } | open stmts optsemis close { $2 }
i believe. - Hal -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume