[GHC] #11377: Template Haskell only imports

GHC ghc-devs at haskell.org
Fri Jan 8 05:35:11 UTC 2016


#11377: Template Haskell only imports
-------------------------------------+-------------------------------------
           Reporter:  ezyang         |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  low            |         Milestone:
          Component:  Template       |           Version:  7.11
  Haskell                            |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 This is the Template Haskell equivalent of #11244.

 It should be possible to use the plugin package database to make a
 Template Haskell only import; I suggest the syntax `import {-# TH_ONLY #-}
 Foo`. Such imports are only allowed to be used in splices, and cannot be
 quoted (they are not allowed to reside in the final code generated by the
 splice.)

 The reason a user may want to use such an import is that it means that
 they can declare that a library is necessary when compiling splices, but
 not necessary when actually linking against it.

 There are extra benefits. If a user is compiling the package with the
 splices with profiling, it ordinarily requires all imports to have been
 compiled with profiling. This would NOT be necessary for a `TH_ONLY`
 import, since we're only ever going to run the imported code in the (non-
 profiled) compiler, and not in the (profiled) executable.)

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


More information about the ghc-tickets mailing list