[GHC] #11081: Implement Introspective Template Haskell

GHC ghc-devs at haskell.org
Wed May 25 09:33:13 UTC 2016


#11081: Implement Introspective Template Haskell
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  ⊥
       Component:  Template Haskell  |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
  TemplateHaskell/Introspective      |
-------------------------------------+-------------------------------------

Comment (by Iceland_jack):

 Replying to [comment:5 simonpj]:
 > I'm very unsure about the back-compat shim, but maybe it's possible. Yay
 for pattern synonyms.

 Could they also be used for other
 [https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0?action=diff&version=42
 migrations]? In [https://hackage.haskell.org/package/template-
 haskell-2.11.0.0/docs/Language-Haskell-TH-Lib.html#v:instanceD
 Language.Haskell.TH.Lib] another function `instanceWithOverlapD` was added
 to prevent breakage:
 {{{#!hs
 instanceD            ::                  CxtQ -> TypeQ -> [DecQ] -> DecQ
 instanceWithOverlapD :: Maybe Overlap -> CxtQ -> TypeQ -> [DecQ] -> DecQ
 }}}
 The same could have been done with `InstanceD`
 {{{#!hs
 --      OLD:
 --  | InstanceD Cxt Type [Dec]
     | InstanceWithOverlapD (Maybe Overlap) Cxt Type [Dec]
 }}}
 and like `ErrorCall` defining
 {{{#!hs
 pattern InstanceD :: Ctx -> Type -> [Dec] -> Dec
 pattern InstanceD ctx ty decs = InstanceWithOverlapD Nothing ctx ty decs
 }}}
 which suffers from the [ticket:8779#comment:12 same problem] as
 `ErrorCall`.

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


More information about the ghc-tickets mailing list