diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2015-12-15 23:57:46 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-12-15 23:59:54 +0100 |
commit | c1e25536d67fba33ad6ddae5556115340d99000a (patch) | |
tree | 4aa98e5fd9faa46df67412f94fef33d52205181e /compiler/typecheck/TcPat.hs | |
parent | 28638dfe79e915f33d75a1b22c5adce9e2b62b97 (diff) | |
download | haskell-c1e25536d67fba33ad6ddae5556115340d99000a.tar.gz |
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
Diffstat (limited to 'compiler/typecheck/TcPat.hs')
-rw-r--r-- | compiler/typecheck/TcPat.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/typecheck/TcPat.hs b/compiler/typecheck/TcPat.hs index 074532276e..6b22aa6bf6 100644 --- a/compiler/typecheck/TcPat.hs +++ b/compiler/typecheck/TcPat.hs @@ -48,6 +48,7 @@ import Util import Outputable import FastString import Maybes( orElse ) +import qualified GHC.LanguageExtensions as LangExt import Control.Monad {- @@ -674,8 +675,8 @@ tcDataConPat penv (L con_span con_name) data_con pat_ty arg_pats thing_inside LamPat mc -> PatSkol (RealDataCon data_con) mc LetPat {} -> UnkSkol -- Doesn't matter - ; gadts_on <- xoptM Opt_GADTs - ; families_on <- xoptM Opt_TypeFamilies + ; gadts_on <- xoptM LangExt.GADTs + ; families_on <- xoptM LangExt.TypeFamilies ; checkTc (no_equalities || gadts_on || families_on) (text "A pattern match on a GADT requires the" <+> text "GADTs or TypeFamilies language extension") |