summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-03-11 17:52:48 +0000
committerIan Lynagh <igloo@earth.li>2012-03-11 17:52:48 +0000
commite212079dce3b86df4124d4dd819640f85f479a71 (patch)
treefba79be2fafc3ef3259b517fd612028761617008 /ghc
parent11ad9277380434e4824f7fdb0f4deb5434945dee (diff)
downloadhaskell-e212079dce3b86df4124d4dd819640f85f479a71.tar.gz
In ghci, reload after :e. Patch from Paolo Capriotti. Fixes #5343
Diffstat (limited to 'ghc')
-rw-r--r--ghc/InteractiveUI.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index a6396ec77d..045c6a6af4 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -126,7 +126,7 @@ builtin_commands = [
("def", keepGoing (defineMacro False), completeExpression),
("def!", keepGoing (defineMacro True), completeExpression),
("delete", keepGoing deleteCmd, noCompletion),
- ("edit", keepGoing editFile, completeFilename),
+ ("edit", keepGoing' editFile, completeFilename),
("etags", keepGoing createETagsFileCmd, completeFilename),
("force", keepGoing forceCmd, completeExpression),
("forward", keepGoing forwardCmd, noCompletion),
@@ -1053,15 +1053,16 @@ trySuccess act =
-----------------------------------------------------------------------------
-- :edit
-editFile :: String -> GHCi ()
+editFile :: String -> InputT GHCi ()
editFile str =
- do file <- if null str then chooseEditFile else return str
- st <- getGHCiState
+ do file <- if null str then lift chooseEditFile else return str
+ st <- lift getGHCiState
let cmd = editor st
when (null cmd)
$ ghcError (CmdLineError "editor not set, use :set editor")
- _ <- liftIO $ system (cmd ++ ' ':file)
- return ()
+ code <- liftIO $ system (cmd ++ ' ':file)
+ when (code == ExitSuccess)
+ $ reloadModule ""
-- The user didn't specify a file so we pick one for them.
-- Our strategy is to pick the first module that failed to load,