summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/T10820.hs
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2015-12-15 23:57:46 +0100
committerBen Gamari <ben@smart-cactus.org>2015-12-15 23:59:54 +0100
commitc1e25536d67fba33ad6ddae5556115340d99000a (patch)
tree4aa98e5fd9faa46df67412f94fef33d52205181e /testsuite/tests/th/T10820.hs
parent28638dfe79e915f33d75a1b22c5adce9e2b62b97 (diff)
downloadhaskell-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 'testsuite/tests/th/T10820.hs')
-rw-r--r--testsuite/tests/th/T10820.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/th/T10820.hs b/testsuite/tests/th/T10820.hs
new file mode 100644
index 0000000000..0e53bbde72
--- /dev/null
+++ b/testsuite/tests/th/T10820.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE LiberalTypeSynonyms #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE MagicHash #-}
+
+module Main where
+
+import Language.Haskell.TH.Syntax
+import GHC.LanguageExtensions
+
+main = do
+ print $(isExtEnabled Cpp >>= lift)
+ print $(isExtEnabled LiberalTypeSynonyms >>= lift)
+ print $(isExtEnabled RankNTypes >>= lift)
+ print $(isExtEnabled TypeSynonymInstances >>= lift)
+ print $(isExtEnabled MagicHash >>= lift)