[GHC] #8660: unexpected parsing error, "in" is treated as reserved word in type class constraints

#8660: unexpected parsing error, "in" is treated as reserved word in type class constraints -------------------------------------+------------------------------------- Reporter: carter | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Parser) | Version: 7.7 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | -------------------------------------+------------------------------------- I'm amidst writing a nice ffi binding to BLAS for ghc 7.6 and newer, and I hit an bizarre parser error when i had the follwoing type for a function transpose {{{ transposeMatrix :: (in ~ (Transpose out) , out ~ (Transpose in) ) => Matrix in elem -> Matrix out elem transposeMatrix (RowMajorMatrix x y stride arr)= (ColMajorMatrix x y stride arr) transposeMatrix (ColMajorMatrix x y stride arr) =(RowMajorMatrix x y stride arr) }}} {{{ src/Numerical/OpenBLAS/MatrixTypes.hs:83:21: parse error on input ‛in’ Failed, modules loaded: none. }}} i hit this error in GHC head I built this week AND with ghc 7.6 i'm pretty sure "in" shouldn't be a reserved word in types! If i rename "in" to "inor" the parser error goes away. if this is valid behavior, it'd be hepful to get a more precise parser error like "encountered reserved word "in", expected a variable" attaching the full module for your pleasure thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8660 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8660: unexpected parsing error, "in" is treated as reserved word in type class constraints --------------------------------------+------------------------------------ Reporter: carter | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Parser) | Version: 7.7 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: --------------------------------------+------------------------------------ Changes (by simonpj): * status: new => closed * resolution: => invalid Comment: Well, for better or worse, `in` is a keyword: see the [http://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-160002.2 language definition]. Some words like `hiding` have special significance only in particular places, but `in` isn't one of them. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8660#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8660: unexpected parsing error, "in" is treated as reserved word in type class constraints --------------------------------------+------------------------------------ Reporter: carter | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Parser) | Version: 7.7 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: --------------------------------------+------------------------------------ Comment (by carter): agree, I'm moreso suggesting that the error message should be more like "error, unexpected reserved word "in" at $FILE:LOCATION" rather than "there was a syntax error here". -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8660#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC