[GHC] #10188: prefix type-level cons can't be parsed

GHC ghc-devs at haskell.org
Sun Mar 29 16:58:42 UTC 2015


#10188: prefix type-level cons can't be parsed
-------------------------------------+-------------------------------------
        Reporter:  Kinokkory         |                   Owner:  Kinokkory
            Type:  bug               |                  Status:  patch
        Priority:  normal            |               Milestone:  7.12.1
       Component:  Compiler          |                 Version:  7.8.4
  (Parser)                           |                Keywords:
      Resolution:                    |            Architecture:
Operating System:  Unknown/Multiple  |  Unknown/Multiple
 Type of failure:  GHC rejects       |               Test Case:
  valid program                      |                Blocking:
      Blocked By:                    |  Differential Revisions:  Phab:D768
 Related Tickets:  #10189            |
-------------------------------------+-------------------------------------

Comment (by Kinokkory):

 This patch makes `(:) Int [Float, Double]` and `Int : [Float, Double]`
 parsed.

 In fact, infix type-level cons also used to be not parsed without `'`.

 Essentially, I changed the definition of `tyconsym` by adding `| ':' ...`.

 {{{
 tyconsym :: { Located RdrName }
         : CONSYM                { sL1 $1 $! mkUnqual tcClsName (getCONSYM
 $1) }
         | VARSYM                { sL1 $1 $! mkUnqual tcClsName (getVARSYM
 $1) }
         | ':'                   { sL1 $1 $! consDataCon_RDR }
         | '*'                   { sL1 $1 $! mkUnqual tcClsName (fsLit "*")
 }
         | '-'                   { sL1 $1 $! mkUnqual tcClsName (fsLit "-")
 }
 }}}

 By the way I wonder what `| '*' ...` and `| '-' ...` are for.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10188#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list