#3766: Parsing of lambdas is not consistent with Haskell'98 report.
---------------------------------+------------------------------------------
Reporter: lilac | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler (Parser)
Version: 6.10.4 | Keywords:
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: GHC rejects valid program
---------------------------------+------------------------------------------
Consider the following expression:
{{{ (\x -> x :: Int . id)}}}
GHC (without any -X flags) currently reports a parse error:
Illegal operator `.' in type `Int . id'[[br]] Use -XTypeOperators
to allow operators in types
However, I think this expression is legal in Haskell'98 (and indeed still
legal in Haskell 2010). The report gives an (ambiguous) expression
grammar, which (unambiguously) parses the above as (\x -> (x :: Int)) .
id. The report further says that lambdas extend as far as possible to the
right, but the parse which GHC is using is not a possible parse according
to the grammar, since infix operators (other than "->") are not allowed in
the construction 'type'.
That said, I'd much rather see this fixed in the Haskell 2011 report than
in GHC :)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3766>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs