[GHC] #11046: lookupTypeName does not support type operators

GHC ghc-devs at haskell.org
Sun Nov 1 20:27:40 UTC 2015


#11046: lookupTypeName does not support type operators
-------------------------------------+-------------------------------------
        Reporter:  oerjan            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by oerjan):

 On a hunch I did a further test: `lookupTypeName` ''does'' work with a
 type operator if it starts with `:`.

 A bit more flexible test file:

 {{{#!hs
 {-# LANGUAGE TemplateHaskell #-}
 module IssueTH where
 import Language.Haskell.TH

 f :: String -> Q [Dec]
 f n = do
     Just n <- lookupTypeName n
     return []
 }}}

 And then in GHCi:

 {{{
 *IssueTH> :set -XTypeOperators
 *IssueTH> :set -XTemplateHaskell
 *IssueTH> data a :& b = A
 *IssueTH> data a & b = B
 *IssueTH> data Dummy; $(f ":&")
 *IssueTH> data Dummy; $(f "&")

 <interactive>:7:15:
     Pattern match failure in do expression at IssueTH.hs:9:5-10
 }}}

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


More information about the ghc-tickets mailing list