[GHC] #9734: Provide macro __GLASGOW_HASKELL_TH__

GHC ghc-devs at haskell.org
Tue Oct 28 14:56:55 UTC 2014


#9734: Provide macro  __GLASGOW_HASKELL_TH__
-------------------------------------+-------------------------------------
       Reporter:  nomeata            |                   Owner:
           Type:  feature request    |                  Status:  new
       Priority:  normal             |               Milestone:  7.10.1
      Component:  Compiler           |                 Version:  7.8.3
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:
     Blocked By:                     |  None/Unknown
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 The Debian packaging added a few hacks to create a CPP macro that can be
 used to distinguish compilers with Template Haskell support from those
 that don’t have that support.  We need this to compiler some code on non-
 TH architectures.

 It works, but we found that we cannot upstream such patches, which is a
 shame.

 I propose that among the GHC-defined macros listed at
 https://www.haskell.org/ghc/docs/latest/html/users_guide/options-
 phases.html#c-pre-processor there is also `__GLASGOW_HASKELL_TH__=YES`,
 which is available if the compiler supports splices, or
 ``__GLASGOW_HASKELL_TH__=NO` if not.

 (I propose a two-valued comparison so that library authors can decide
 themselves what the default should be if this symbol is not defined, some
 might want to use TH on older compilers, some not.)

 I hope this can be part of 7.10.

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


More information about the ghc-tickets mailing list