Expose enabled language extensions to TH
[ghc.git] / testsuite / tests / ghc-api / T10508_api.hs
1 module Main where
2
3 import DynFlags
4 import GHC
5 import qualified GHC.LanguageExtensions as LangExt
6
7 import Control.Monad (forM_)
8 import Control.Monad.IO.Class (liftIO)
9 import System.Environment (getArgs)
10
11 main :: IO ()
12 main = do
13 [libdir] <- getArgs
14 runGhc (Just libdir) $ do
15 dflags <- getSessionDynFlags
16 setSessionDynFlags $ dflags
17 `gopt_unset` Opt_ImplicitImportQualified
18 `xopt_unset` LangExt.ImplicitPrelude
19
20 forM_ exprs $ \expr ->
21 handleSourceError printException $ do
22 dyn <- dynCompileExpr expr
23 liftIO $ print dyn
24 where
25 exprs =
26 [ ""
27 , "(),()"
28 , "()"
29 , "\"test\""
30 , unlines [ "[()]"
31 , " :: [()]"
32 ]
33 ]