[GHC] #14030: Implement the "Derive Lift instances for data types in template-haskell" proposal

GHC ghc-devs at haskell.org
Tue Mar 5 18:33:44 UTC 2019


#14030: Implement the "Derive Lift instances for data types in template-haskell"
proposal
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  RyanGlScott
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:  8.10.1
       Component:  Template Haskell  |              Version:  8.3
      Resolution:                    |             Keywords:  deriving
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 To confirm my hunch that even generating code with bracket syntax would
 still be fragile, I tried compiling GHC 8.4.4 with 8.2.2 as the
 bootstrapping compiler again, but instead of attempting to derive a `Lift`
 instance for `Role`, I defined one manually using bracket syntax:

 {{{#!hs
 instance Lift Role where
   lift NominalR = [| NominalR |]
   ...
 }}}

 Alas, that also suffers from the same issues observed in comment:7:

 {{{
 libraries/template-haskell/Language/Haskell/TH/Syntax.hs:2005:28: error:
     • Failed to load interface for ‘Language.Haskell.TH.Lib’
       Use -v to see a list of the files searched for.
     • In the expression: [| NominalR |]
       In an equation for ‘lift’: lift NominalR = [| NominalR |]
       In the instance declaration for ‘Lift Role’
      |
 2005 |   lift NominalR          = [| NominalR |]
      |                            ^^^^^^^^^^^^^^
 }}}

 This all seems horribly delicate. There has to be a way to ensure that
 subsequent changes to `template-haskell` won't break the build in similar
 ways, but I can't think of how to orchestrate this.

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


More information about the ghc-tickets mailing list