summaryrefslogtreecommitdiff
path: root/compiler/main/GHC.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main/GHC.hs')
-rw-r--r--compiler/main/GHC.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index 15e488bd09..92ee0f4a44 100644
--- a/compiler/main/GHC.hs
+++ b/compiler/main/GHC.hs
@@ -122,6 +122,11 @@ module GHC (
#endif
lookupName,
+#ifdef GHCI
+ -- ** EXPERIMENTAL
+ setGHCiMonad,
+#endif
+
-- * Abstract syntax elements
-- ** Packages
@@ -1330,6 +1335,21 @@ isModuleTrusted :: GhcMonad m => Module -> m Bool
isModuleTrusted m = withSession $ \hsc_env ->
liftIO $ hscCheckSafe hsc_env m noSrcSpan
+-- | EXPERIMENTAL: DO NOT USE.
+--
+-- Set the monad GHCi lifts user statements into.
+--
+-- Checks that a type (in string form) is an instance of the
+-- @GHC.GHCi.GHCiSandboxIO@ type class. Sets it to be the GHCi monad if it is,
+-- throws an error otherwise.
+{-# WARNING setGHCiMonad "This is experimental! Don't use." #-}
+setGHCiMonad :: GhcMonad m => String -> m ()
+setGHCiMonad name = withSession $ \hsc_env -> do
+ ty <- liftIO $ hscIsGHCiMonad hsc_env name
+ modifySession $ \s ->
+ let ic = (hsc_IC s) { ic_monad = ty }
+ in s { hsc_IC = ic }
+
getHistorySpan :: GhcMonad m => History -> m SrcSpan
getHistorySpan h = withSession $ \hsc_env ->
return $ InteractiveEval.getHistorySpan hsc_env h