
Message: 2 Date: Sun, 13 Jul 2003 12:52:40 +0100 To: libraries@haskell.org Subject: Re: some bugs in Language.Haskell.Parser From: Ross Paterson
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).
No problem :).
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.
I think you're right :). GHC accepts it, Hugs does not: 10:21am moussor:~/ cat > Foo.hs main = do {putStrLn "Hi";;} 10:21am moussor:~/ ghc Foo.hs 10:21am moussor:~/ ./a.out Hi 10:21am moussor:~/ hugs Foo.hs __ __ __ __ ____ ___ _________________________________________ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2001 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Report bugs to: hugs-bugs@haskell.org || || Version: December 2001 _________________________________________ Haskell 98 mode: Restart with command line option -98 to enable extensions Reading file "/nfs/moussor/hdaume/share/hugs/lib/Prelude.hs": Reading file "Foo.hs": Parsing ERROR "Foo.hs":1 - Syntax error in definition (unexpected `;', possibly due to b ad layout) I think GHC is in error here. According to the report: 3.14 Do Expressions exp -> do { stmts } (do expression) stmts -> stmt1 ... stmtn exp [;] (n>=0) stmt -> exp ; | pat <- exp ; | let decls ; | ; (empty statement) There's clearly no final exp in the stmts. That's what I get for trusting GHC too much :) - Hal
participants (1)
-
Hal Daume III