Ticket #7962: 0002-Refactored-by-Simon-Marlow-s-suggestion.patch

File 0002-Refactored-by-Simon-Marlow-s-suggestion.patch, 1.1 KB (added by khyperia, 5 months ago)

Refactoring patch

  • ghc/InteractiveUI.hs

    From 956224549377463289b165a5a990b9afc6f1c4f6 Mon Sep 17 00:00:00 2001
    From: Evan Hauck <khyperia@live.com>
    Date: Thu, 28 Nov 2013 11:58:50 -0500
    Subject: [PATCH 2/2] Refactored by Simon Marlow's suggestion
    
    ---
     ghc/InteractiveUI.hs | 6 ++----
     1 file changed, 2 insertions(+), 4 deletions(-)
    
    diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
    index 024aa2d..be97bc0 100644
    a b runCommands' eh sourceErrorHandler gCmd = do 
    694694    case b of 
    695695      Nothing -> return () 
    696696      Just success -> do 
    697         let nextCommand = runCommands' eh sourceErrorHandler gCmd 
    698         case sourceErrorHandler of 
    699           Just handler | success == False -> lift handler >> nextCommand 
    700           _ -> nextCommand 
     697        when (not success) $ maybe (return ()) lift sourceErrorHandler 
     698        runCommands' eh sourceErrorHandler gCmd 
    701699 
    702700-- | Evaluate a single line of user input (either :<command> or Haskell code) 
    703701runOneCommand :: (SomeException -> GHCi Bool) -> InputT GHCi (Maybe String)