Skip to content

`ghc --supported-extension` shall not list `TemplateHaskell` when unsupported

Currently GHC advertises TemplateHaskell even though it's statically known to fail:

$ ghc --supported-extensions | grep Template
TemplateHaskell
NoTemplateHaskell

# `NoTemplateHaskell` works:
$ ghc -XNoTemplateHaskell -c hello.hs

# `TemplateHaskell` however fails even though advertised:
$ ghc -XTemplateHaskell -c hello.hs
ghc: on the commandline: Template Haskell requires GHC with interpreter support
    Perhaps you are using a stage-1 compiler?
Usage: For basic information, try the `--help' option.

Having properly advertised extensions is particularly useful in combination with Cabal#2644 allowing the solver to toggle flags depending on the availability of -XTemplateHaskell.

For instance, cross-compilers and/or unregisterised GHC builds often don't have TemplateHaskell support. Having support for toggling flags based on availability of -XTemplateHaskell allows cabal to support such environments with less manual intervention.

(See also https://github.com/haskell/cabal/pull/2930 for pre-GHC8 emulation of this feature)

Trac metadata
Trac field Value
Version 7.10.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information