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

GHC ghc-devs at haskell.org
Fri Jan 10 07:31:09 UTC 2014


#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


More information about the ghc-tickets mailing list