diff options
author | Simon Marlow <marlowsd@gmail.com> | 2012-04-25 14:04:10 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2012-04-25 14:04:22 +0100 |
commit | 7679603b9898754c5830542cefc389fd14d0a559 (patch) | |
tree | 78ff62b9a41cccd9ca9c440f251f9836ec1f32a3 /ghc | |
parent | 84d79a2a1f5aa16fffbc1451d229930abf8da36b (diff) | |
download | haskell-7679603b9898754c5830542cefc389fd14d0a559.tar.gz |
make -XNoImplicitPrelude work properly in GHCi
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/InteractiveUI.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index 75e8ca0f67..f2331b24cf 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -1720,12 +1720,11 @@ setGHCContextFromGHCiState = do -- the actual exception thrown by checkAdd, using tryBool to -- turn it into a Bool. iidecls <- filterM (tryBool.checkAdd) (transient_ctx st ++ remembered_ctx st) - GHC.setContext (maybeAddPrelude iidecls) - where - maybeAddPrelude :: [InteractiveImport] -> [InteractiveImport] - maybeAddPrelude iidecls - | any isPreludeImport iidecls = iidecls - | otherwise = iidecls ++ [implicitPreludeImport] + dflags <- GHC.getSessionDynFlags + GHC.setContext $ + if xopt Opt_ImplicitPrelude dflags && not (any isPreludeImport iidecls) + then iidecls ++ [implicitPreludeImport] + else iidecls -- XXX put prel at the end, so that guessCurrentModule doesn't pick it up. |