[commit: ghc] master: Use catchException in a few more places (a1c4230)

git at git.haskell.org git at git.haskell.org
Fri Mar 11 12:27:02 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/a1c4230e15cbf897b97903c8a1199a1cc91efd26/ghc

>---------------------------------------------------------------

commit a1c4230e15cbf897b97903c8a1199a1cc91efd26
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Fri Mar 11 10:43:52 2016 +0100

    Use catchException in a few more places
    
    These are cases in the standard library that may benefit from the
    strictness signature of catchException and where we know that the action
    won't bottom.
    
    Test Plan: Validate, carefully consider changed callsites
    
    Reviewers: austin, hvr
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1972


>---------------------------------------------------------------

a1c4230e15cbf897b97903c8a1199a1cc91efd26
 libraries/base/Control/Concurrent.hs | 6 +++---
 libraries/base/GHC/IO/Handle/Text.hs | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libraries/base/Control/Concurrent.hs b/libraries/base/Control/Concurrent.hs
index 535b2f0..9b328b6 100644
--- a/libraries/base/Control/Concurrent.hs
+++ b/libraries/base/Control/Concurrent.hs
@@ -109,7 +109,7 @@ import Control.Exception.Base as Exception
 
 import GHC.Conc hiding (threadWaitRead, threadWaitWrite,
                         threadWaitReadSTM, threadWaitWriteSTM)
-import GHC.IO           ( unsafeUnmask )
+import GHC.IO           ( unsafeUnmask, catchException )
 import GHC.IORef        ( newIORef, readIORef, writeIORef )
 import GHC.Base
 
@@ -308,7 +308,7 @@ forkOS action0
                         MaskedInterruptible -> action0
                         MaskedUninterruptible -> uninterruptibleMask_ action0
 
-            action_plus = Exception.catch action1 childHandler
+            action_plus = catchException action1 childHandler
 
         entry <- newStablePtr (myThreadId >>= putMVar mv >> action_plus)
         err <- forkOS_createThread entry
@@ -381,7 +381,7 @@ runInUnboundThread action = do
       mv <- newEmptyMVar
       mask $ \restore -> do
         tid <- forkIO $ Exception.try (restore action) >>= putMVar mv
-        let wait = takeMVar mv `Exception.catch` \(e :: SomeException) ->
+        let wait = takeMVar mv `catchException` \(e :: SomeException) ->
                      Exception.throwTo tid e >> wait
         wait >>= unsafeResult
     else action
diff --git a/libraries/base/GHC/IO/Handle/Text.hs b/libraries/base/GHC/IO/Handle/Text.hs
index 65832c7..4a5e4cf 100644
--- a/libraries/base/GHC/IO/Handle/Text.hs
+++ b/libraries/base/GHC/IO/Handle/Text.hs
@@ -246,7 +246,7 @@ hGetLineBufferedLoop handle_ at Handle__{..}
 
 maybeFillReadBuffer :: Handle__ -> CharBuffer -> IO (Maybe CharBuffer)
 maybeFillReadBuffer handle_ buf
-  = Exception.catch
+  = catchException
      (do buf' <- getSomeCharacters handle_ buf
          return (Just buf')
      )



More information about the ghc-commits mailing list