[GHC] #10823: Expose keepAlive to Template Haskell

GHC ghc-devs at haskell.org
Thu Sep 3 07:05:52 UTC 2015


#10823: Expose keepAlive to Template Haskell
-------------------------------------+-------------------------------------
        Reporter:  spinda            |                   Owner:
            Type:  feature request   |                  Status:  new
        Priority:  normal            |               Milestone:  7.12.1
       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 Revisions:
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Replying to [comment:4 spinda]:
 > Is the use of type-level literals essential here? That requires the user
 to have {{{DataKinds}}} enabled. Otherwise, the hack can fill our use
 case, I think.

 No. It's just a convenient way to make sure that the instance head is
 unique. Any such mechanism should work.

 >
 > On the other hand, I worry about Template Haskell code having to depend
 too much on tricks that happen to work but aren't a guaranteed, stable,
 documented part of the interface.

 Agreed. Except that this is depending on a guaranteed, stable, documented
 feature: that ''all'' instance are always exported from a module. Thus if
 a definition is mentioned in an instance, GHC will never drop it. So this
 isn't a TH hack so much, but a GHC language hack.

 > //That said//, as I write this, I've realized that there may be another
 way to approach our particular issue. {{{[lq| inline gt |]}}} attaches an
 annotation to {{{gt}}}, so perhaps the solution should be to tell the
 desugarer not to consider any function with an annotation attached as dead
 code.

 This is ''much'' better. Care to repurpose the ticket?

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


More information about the ghc-tickets mailing list