Expose enabled language extensions to TH
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 15 Dec 2015 22:57:46 +0000 (23:57 +0100)
committerBen Gamari <ben@smart-cactus.org>
Tue, 15 Dec 2015 22:59:54 +0000 (23:59 +0100)
commitc1e25536d67fba33ad6ddae5556115340d99000a
tree4aa98e5fd9faa46df67412f94fef33d52205181e
parent28638dfe79e915f33d75a1b22c5adce9e2b62b97
Expose enabled language extensions to TH

This exposes `template-haskell` functions for querying the language
extensions which are enabled when compiling a module,

- an `isExtEnabled` function to check whether an extension is enabled
- an `extsEnabled` function to obtain a full list of enabled extensions

To avoid code duplication this adds a `GHC.LanguageExtensions` module to
`ghc-boot` and moves `DynFlags.ExtensionFlag` into it. A happy
consequence of this is that the ungainly `DynFlags` lost around 500
lines. Moreover, flags corresponding to language extensions are now
clearly distinguished from other flags due to the `LangExt.*` prefix.

Updates haddock submodule.

This fixes #10820.

Test Plan: validate

Reviewers: austin, spinda, hvr, goldfire, alanz

Reviewed By: goldfire

Subscribers: mpickering, RyanGlScott, hvr, simonpj, thomie

Differential Revision: https://phabricator.haskell.org/D1200

GHC Trac Issues: #10820
58 files changed:
compiler/basicTypes/MkId.hs
compiler/deSugar/DsBinds.hs
compiler/deSugar/DsMonad.hs
compiler/deSugar/DsUtils.hs
compiler/deSugar/MatchLit.hs
compiler/main/DriverPipeline.hs
compiler/main/DynFlags.hs
compiler/main/GHC.hs
compiler/main/GhcMake.hs
compiler/main/HeaderInfo.hs
compiler/parser/Lexer.x
compiler/parser/Parser.y
compiler/parser/RdrHsSyn.hs
compiler/rename/RnBinds.hs
compiler/rename/RnEnv.hs
compiler/rename/RnExpr.hs
compiler/rename/RnNames.hs
compiler/rename/RnPat.hs
compiler/rename/RnSource.hs
compiler/rename/RnSplice.hs
compiler/rename/RnTypes.hs
compiler/typecheck/Inst.hs
compiler/typecheck/TcBinds.hs
compiler/typecheck/TcDefaults.hs
compiler/typecheck/TcDeriv.hs
compiler/typecheck/TcEnv.hs
compiler/typecheck/TcErrors.hs
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcForeign.hs
compiler/typecheck/TcHsSyn.hs
compiler/typecheck/TcHsType.hs
compiler/typecheck/TcInstDcls.hs
compiler/typecheck/TcInteract.hs
compiler/typecheck/TcMType.hs
compiler/typecheck/TcMatches.hs
compiler/typecheck/TcPat.hs
compiler/typecheck/TcRnDriver.hs
compiler/typecheck/TcRnMonad.hs
compiler/typecheck/TcSimplify.hs
compiler/typecheck/TcSplice.hs
compiler/typecheck/TcTyClsDecls.hs
compiler/typecheck/TcType.hs
compiler/typecheck/TcValidity.hs
docs/users_guide/7.12.1-notes.rst
ghc/InteractiveUI.hs
ghc/ghc-bin.cabal.in
libraries/ghc-boot/GHC/LanguageExtensions.hs [new file with mode: 0644]
libraries/ghc-boot/ghc-boot.cabal
libraries/template-haskell/Language/Haskell/TH.hs
libraries/template-haskell/Language/Haskell/TH/LanguageExtensions.hs [new file with mode: 0644]
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
libraries/template-haskell/template-haskell.cabal
testsuite/tests/ghc-api/T10508_api.hs
testsuite/tests/th/T10820.hs [new file with mode: 0644]
testsuite/tests/th/T10820.stdout [new file with mode: 0644]
testsuite/tests/th/all.T
utils/haddock
utils/mkUserGuidePart/Main.hs