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 /libraries/ghc-boot | |
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 'libraries/ghc-boot')
-rw-r--r-- | libraries/ghc-boot/GHC/LanguageExtensions.hs | 122 | ||||
-rw-r--r-- | libraries/ghc-boot/ghc-boot.cabal | 1 |
2 files changed, 123 insertions, 0 deletions
diff --git a/libraries/ghc-boot/GHC/LanguageExtensions.hs b/libraries/ghc-boot/GHC/LanguageExtensions.hs new file mode 100644 index 0000000000..b108013f4b --- /dev/null +++ b/libraries/ghc-boot/GHC/LanguageExtensions.hs @@ -0,0 +1,122 @@ +----------------------------------------------------------------------------- +-- | +-- Module : GHC.LanguageExtensions +-- Copyright : (c) The GHC Team +-- +-- Maintainer : ghc-devs@haskell.org +-- Portability : portable +-- +-- A data type defining the language extensions supported by GHC. +-- +module GHC.LanguageExtensions ( Extension(..) ) where + +-- | The language extensions known to GHC. +data Extension +-- See Note [Updating flag description in the User's Guide] in DynFlags + = Cpp + | OverlappingInstances + | UndecidableInstances + | IncoherentInstances + | UndecidableSuperClasses + | MonomorphismRestriction + | MonoPatBinds + | MonoLocalBinds + | RelaxedPolyRec -- Deprecated + | ExtendedDefaultRules -- Use GHC's extended rules for defaulting + | ForeignFunctionInterface + | UnliftedFFITypes + | InterruptibleFFI + | CApiFFI + | GHCForeignImportPrim + | JavaScriptFFI + | ParallelArrays -- Syntactic support for parallel arrays + | Arrows -- Arrow-notation syntax + | TemplateHaskell + | TemplateHaskellQuotes -- subset of TH supported by stage1, no splice + | QuasiQuotes + | ImplicitParams + | ImplicitPrelude + | ScopedTypeVariables + | AllowAmbiguousTypes + | UnboxedTuples + | BangPatterns + | TypeFamilies + | TypeInType + | OverloadedStrings + | OverloadedLists + | NumDecimals + | DisambiguateRecordFields + | RecordWildCards + | RecordPuns + | ViewPatterns + | GADTs + | GADTSyntax + | NPlusKPatterns + | DoAndIfThenElse + | RebindableSyntax + | ConstraintKinds + | PolyKinds -- Kind polymorphism + | DataKinds -- Datatype promotion + | InstanceSigs + | ApplicativeDo + + | StandaloneDeriving + | DeriveDataTypeable + | AutoDeriveTypeable -- Automatic derivation of Typeable + | DeriveFunctor + | DeriveTraversable + | DeriveFoldable + | DeriveGeneric -- Allow deriving Generic/1 + | DefaultSignatures -- Allow extra signatures for defmeths + | DeriveAnyClass -- Allow deriving any class + | DeriveLift -- Allow deriving Lift + + | TypeSynonymInstances + | FlexibleContexts + | FlexibleInstances + | ConstrainedClassMethods + | MultiParamTypeClasses + | NullaryTypeClasses + | FunctionalDependencies + | UnicodeSyntax + | ExistentialQuantification + | MagicHash + | EmptyDataDecls + | KindSignatures + | RoleAnnotations + | ParallelListComp + | TransformListComp + | MonadComprehensions + | GeneralizedNewtypeDeriving + | RecursiveDo + | PostfixOperators + | TupleSections + | PatternGuards + | LiberalTypeSynonyms + | RankNTypes + | ImpredicativeTypes + | TypeOperators + | ExplicitNamespaces + | PackageImports + | ExplicitForAll + | AlternativeLayoutRule + | AlternativeLayoutRuleTransitional + | DatatypeContexts + | NondecreasingIndentation + | RelaxedLayout + | TraditionalRecordSyntax + | LambdaCase + | MultiWayIf + | BinaryLiterals + | NegativeLiterals + | DuplicateRecordFields + | OverloadedLabels + | EmptyCase + | PatternSynonyms + | PartialTypeSignatures + | NamedWildCards + | StaticPointers + | Strict + | StrictData + | MonadFailDesugaring + deriving (Eq, Enum, Show) diff --git a/libraries/ghc-boot/ghc-boot.cabal b/libraries/ghc-boot/ghc-boot.cabal index 98929b7f83..7f0f14fc8c 100644 --- a/libraries/ghc-boot/ghc-boot.cabal +++ b/libraries/ghc-boot/ghc-boot.cabal @@ -36,6 +36,7 @@ Library exposed-modules: GHC.Lexeme GHC.PackageDb + GHC.LanguageExtensions build-depends: base >= 4 && < 5, binary >= 0.7 && < 0.8, |