blob: 9a5450fbd35fe191eaa54dc1e8c000af8b75da5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
module Main where
import GHC
import GHC.Unit.State
import GHC.Driver.Monad
import GHC.Driver.Session
import GHC.Driver.Env
import GHC.Utils.Outputable
import GHC.Unit.Module
import System.Environment
main =
do [libdir] <- getArgs
_ <- runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
setSessionDynFlags dflags
state <- hsc_units <$> getSession
liftIO $ print (mkModuleName "GHC.Utils.Outputable" `elem` listVisibleModuleNames state)
_ <- runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
setSessionDynFlags (dflags {
packageFlags = [ExposePackage "-package ghc"
(PackageArg "ghc")
(ModRenaming True [])]
})
state <- hsc_units <$> getSession
liftIO $ print (mkModuleName "GHC.Utils.Outputable" `elem` listVisibleModuleNames state)
return ()
|