summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-04-25 14:04:10 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-04-25 14:04:22 +0100
commit7679603b9898754c5830542cefc389fd14d0a559 (patch)
tree78ff62b9a41cccd9ca9c440f251f9836ec1f32a3 /ghc
parent84d79a2a1f5aa16fffbc1451d229930abf8da36b (diff)
downloadhaskell-7679603b9898754c5830542cefc389fd14d0a559.tar.gz
make -XNoImplicitPrelude work properly in GHCi
Diffstat (limited to 'ghc')
-rw-r--r--ghc/InteractiveUI.hs11
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.