summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Hauck <khyperia@live.com>2013-11-28 11:58:50 -0500
committerAustin Seipp <austin@well-typed.com>2013-12-04 18:19:48 -0600
commit415f0d6cb716b68318dad1af4e9ab6ec13844136 (patch)
tree917a32b382aaf1be4db162afcbd85027ebe4d480
parent47024b63835e2bc238f88e3e1a5b5927a850e74c (diff)
downloadhaskell-415f0d6cb716b68318dad1af4e9ab6ec13844136.tar.gz
Refactored by Simon Marlow's suggestion
Signed-off-by: Austin Seipp <austin@well-typed.com>
-rw-r--r--ghc/InteractiveUI.hs6
1 files changed, 2 insertions, 4 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 024aa2d188..be97bc0a15 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -694,10 +694,8 @@ runCommands' eh sourceErrorHandler gCmd = do
case b of
Nothing -> return ()
Just success -> do
- let nextCommand = runCommands' eh sourceErrorHandler gCmd
- case sourceErrorHandler of
- Just handler | success == False -> lift handler >> nextCommand
- _ -> nextCommand
+ when (not success) $ maybe (return ()) lift sourceErrorHandler
+ runCommands' eh sourceErrorHandler gCmd
-- | Evaluate a single line of user input (either :<command> or Haskell code)
runOneCommand :: (SomeException -> GHCi Bool) -> InputT GHCi (Maybe String)