[commit: ghc] ghc-7.4: In ghci, reload after :e. Patch from Paolo Capriotti. Fixes #5343 (21de02b)
Paolo Capriotti
p.capriotti at gmail.com
Tue Mar 13 18:25:42 CET 2012
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : ghc-7.4
http://hackage.haskell.org/trac/ghc/changeset/21de02bc1bf2017e6214b0c6ee6f4f4d15fe9314
>---------------------------------------------------------------
commit 21de02bc1bf2017e6214b0c6ee6f4f4d15fe9314
Author: Ian Lynagh <igloo at earth.li>
Date: Sun Mar 11 17:52:48 2012 +0000
In ghci, reload after :e. Patch from Paolo Capriotti. Fixes #5343
MERGED from commit e212079dce3b86df4124d4dd819640f85f479a71
>---------------------------------------------------------------
ghc/InteractiveUI.hs | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 1e1ac64..a2061c2 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -130,7 +130,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),
@@ -1030,15 +1030,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,
More information about the Cvs-ghc
mailing list