Created
May 22, 2019 14:36
-
-
Save fendor/f3a21bca7e94d18d693e29129656be75 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
-- | Parse command line ghc options and add them to the 'DynFlags' passed | |
addCmdOpts :: GhcMonad m => LoadGhcEnvironment -> [GHCOption] -> DynFlags -> m DynFlags | |
addCmdOpts loadGhcEnv cmdOpts df = | |
if loadGhcEnv == LoadGhcEnvironment | |
then fst3 <$> G.parseDynamicFlags df (map G.noLoc cmdOpts) | |
else | |
-- | |
-- Passes "-hide-all-packages" to the GHC API to prevent parsing of | |
-- package environment files. However this only works if there is no | |
-- invocation of `setSessionDynFlags` before calling `initDynFlagsPure`. | |
-- See ghc tickets #15513, #15541. | |
-- Thanks @lspitzner | |
fst3 <$> G.parseDynamicFlags df (map G.noLoc ("-hide-all-packages":cmdOpts)) | |
-- fst3 <$> G.parseDynamicFlags df (map G.noLoc cmdOpts) | |
where | |
fst3 (a,_,_) = a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment