Created
May 22, 2019 15:20
-
-
Save fendor/9ef947dd3c5ab33bb9d4550425e8c219 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- We have to be more careful about tearing down 'HscEnv's since GHC 8 added an | |
-- out of process GHCI server which has to be shutdown. | |
newLightEnv :: IOish m => (DynFlags -> LightGhc DynFlags) -> m HscEnv | |
newLightEnv mdf = do | |
df <- liftIO $ do | |
#if MIN_VERSION_GLASGOW_HASKELL(8,2,0,0) | |
#else | |
initStaticOpts | |
#endif | |
settings <- initSysTools (Just libdir) | |
#if __GLASGOW_HASKELL__ >= 806 | |
let llvmTgtList = ([],[]) -- TODO: where should this come from? | |
initDynFlags $ defaultDynFlags settings llvmTgtList | |
#elif __GLASGOW_HASKELL__ >= 804 | |
let llvmTgtList = [] -- TODO: where should this come from? | |
initDynFlags $ defaultDynFlags settings llvmTgtList | |
#else | |
initDynFlags $ defaultDynFlags settings | |
#endif | |
hsc_env <- liftIO $ newHscEnv df | |
dfLoadedPlugins <- liftIO $ DynamicLoading.initializePlugins hsc_env df | |
df' <- runLightGhc hsc_env $ mdf dfLoadedPlugins | |
return $ hsc_env { | |
hsc_dflags = df', | |
hsc_IC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment