summaryrefslogtreecommitdiff
path: root/ghc/InteractiveUI.hs
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2012-01-31 19:48:00 -0800
committerDavid Terei <davidterei@gmail.com>2012-04-12 18:06:35 -0700
commiteecd7c98c1f079c14d99ed831dff33a48ee45e67 (patch)
tree2a99a6f7438f51c6004a839c2c09e6c477edee52 /ghc/InteractiveUI.hs
parent295717d0e23341427e0b62795d7fa202d5348459 (diff)
downloadhaskell-eecd7c98c1f079c14d99ed831dff33a48ee45e67.tar.gz
Added ':runmonad' command to GHCi
This command allows you to lift user stmts in GHCi into an IO monad that implements the GHC.GHCi.GHCiSandboxIO type class. This allows for easy sandboxing of GHCi using :runmonad and Safe Haskell. Longer term it would be nice to allow a more general model for the Monad than GHCiSandboxIO but delaying this for the moment.
Diffstat (limited to 'ghc/InteractiveUI.hs')
-rw-r--r--ghc/InteractiveUI.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 8d6e23c678..c576b6b5fb 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -144,6 +144,7 @@ builtin_commands = [
("quit", quit, noCompletion),
("reload", keepGoing' reloadModule, noCompletion),
("run", keepGoing runRun, completeFilename),
+ ("runmonad", keepGoing setRunMonad, noCompletion),
("script", keepGoing' scriptCmd, completeFilename),
("set", keepGoing setCmd, completeSetOptions),
("seti", keepGoing setiCmd, completeSeti),
@@ -1487,6 +1488,14 @@ isSafeModule m = do
part pkg = trusted $ getPackageDetails state pkg
-----------------------------------------------------------------------------
+-- :runmonad
+
+-- Set the monad GHCi should execute in
+
+setRunMonad :: String -> GHCi ()
+setRunMonad name = GHC.setGHCiMonad name
+
+-----------------------------------------------------------------------------
-- :browse
-- Browsing a module's contents