[GHC] #14671: Make the Template Haskell class Lift work over typed expressions

GHC ghc-devs at haskell.org
Mon Jan 15 08:59:05 UTC 2018


#14671: Make the Template Haskell class Lift work over typed expressions
-------------------------------------+-------------------------------------
           Reporter:  simonpj        |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Template       |           Version:  8.2.2
  Haskell                            |
           Keywords:                 |  Operating System:  Unknown/Multiple
  TemplateHaskell                    |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 At the moment we have the `Lift` class in TH:
 {{{
 class Lift t where
   lift :: t -> Q Exp
 }}}
 But that loses type information. What we want is this:
 {{{
 Lift t where
   typedLift :: t -> Q (TExp t)

 lift :: Lift t => t -> Q Exp
 lift = fmap unType . typedLift
 }}}
 Otherwise, when you want the typed version, people resort to unsafe-coerce
 operations, which are entirely unnecessary.

 See [https://mail.haskell.org/pipermail/libraries/2018-January/028409.html
 this thread on the libraries list].

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


More information about the ghc-tickets mailing list