summaryrefslogtreecommitdiff
path: root/ghc/Main.hs
diff options
context:
space:
mode:
authorChristiaan Baaij <christiaan.baaij@gmail.com>2018-11-22 11:50:51 -0500
committerBen Gamari <ben@smart-cactus.org>2018-11-22 13:14:01 -0500
commit599eaada382d04722219bfc319bde94591be3fb1 (patch)
tree462b6ad7a5df2be04a77df8b5404822ec4cf4b86 /ghc/Main.hs
parentf088c2d42aaa38b32482ea8c4324786123835e62 (diff)
downloadhaskell-599eaada382d04722219bfc319bde94591be3fb1.tar.gz
Load plugins in interactive session
Reviewers: bgamari, tdammers Reviewed By: tdammers Subscribers: monoidal, rwbarton, carter GHC Trac Issues: #15633 Differential Revision: https://phabricator.haskell.org/D5348
Diffstat (limited to 'ghc/Main.hs')
-rw-r--r--ghc/Main.hs17
1 files changed, 12 insertions, 5 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 15b7aee43e..456ff905eb 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -56,6 +56,7 @@ import Util
import Panic
import UniqSupply
import MonadUtils ( liftIO )
+import DynamicLoading ( initializePlugins )
-- Imports for --abi-hash
import LoadIface ( loadUserInterface )
@@ -259,8 +260,9 @@ main' postLoadMode dflags0 args flagWarnings = do
DoMake -> doMake srcs
DoMkDependHS -> doMkDependHS (map fst srcs)
StopBefore p -> liftIO (oneShot hsc_env p srcs)
- DoInteractive -> ghciUI srcs Nothing
- DoEval exprs -> ghciUI srcs $ Just $ reverse exprs
+ DoInteractive -> ghciUI hsc_env dflags6 srcs Nothing
+ DoEval exprs -> ghciUI hsc_env dflags6 srcs $ Just $
+ reverse exprs
DoAbiHash -> abiHash (map fst srcs)
ShowPackages -> liftIO $ showPackages dflags6
DoFrontend f -> doFrontend f srcs
@@ -268,11 +270,16 @@ main' postLoadMode dflags0 args flagWarnings = do
liftIO $ dumpFinalStats dflags6
-ghciUI :: [(FilePath, Maybe Phase)] -> Maybe [String] -> Ghc ()
+ghciUI :: HscEnv -> DynFlags -> [(FilePath, Maybe Phase)] -> Maybe [String]
+ -> Ghc ()
#if !defined(GHCI)
-ghciUI _ _ = throwGhcException (CmdLineError "not built for interactive use")
+ghciUI _ _ _ _ =
+ throwGhcException (CmdLineError "not built for interactive use")
#else
-ghciUI = interactiveUI defaultGhciSettings
+ghciUI hsc_env dflags0 srcs maybe_expr = do
+ dflags1 <- liftIO (initializePlugins hsc_env dflags0)
+ _ <- GHC.setSessionDynFlags dflags1
+ interactiveUI defaultGhciSettings srcs maybe_expr
#endif
-- -----------------------------------------------------------------------------