summaryrefslogtreecommitdiff
path: root/compiler/GHC/Data
diff options
context:
space:
mode:
authorSasha Bogicevic <sasa.bogicevic@pm.me>2021-04-20 18:13:35 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-26 23:58:56 -0400
commitdd0a95a34657c5b6de003f7177242af990c924aa (patch)
tree7b12f93a1aac65a1072855243d3d6e08f15e79a5 /compiler/GHC/Data
parent72c1812feecd2aff2a96b629063ba90a2f4cdb7b (diff)
downloadhaskell-dd0a95a34657c5b6de003f7177242af990c924aa.tar.gz
18000 Use GHC.IO.catchException in favor of Exception.catch
fix #18000
Diffstat (limited to 'compiler/GHC/Data')
-rw-r--r--compiler/GHC/Data/IOEnv.hs3
-rw-r--r--compiler/GHC/Data/Maybe.hs5
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/GHC/Data/IOEnv.hs b/compiler/GHC/Data/IOEnv.hs
index 5a3c56db3f..29cd831ecb 100644
--- a/compiler/GHC/Data/IOEnv.hs
+++ b/compiler/GHC/Data/IOEnv.hs
@@ -36,6 +36,7 @@ import GHC.Prelude
import GHC.Driver.Session
import {-# SOURCE #-} GHC.Driver.Hooks
+import GHC.IO (catchException)
import GHC.Utils.Exception
import GHC.Unit.Module
import GHC.Utils.Panic
@@ -183,7 +184,7 @@ safeTry act = do
-- Fork, so that 'act' is safe from all asynchronous exceptions other than the ones we send it
t <- forkIO $ try (restore act) >>= putMVar var
restore (readMVar var)
- `catch` \(e :: SomeException) -> do
+ `catchException` \(e :: SomeException) -> do
-- Control reaches this point only if the parent thread was sent an async exception
-- In that case, kill the 'act' thread and re-raise the exception
killThread t
diff --git a/compiler/GHC/Data/Maybe.hs b/compiler/GHC/Data/Maybe.hs
index ac9c687b62..9d47c8ccd8 100644
--- a/compiler/GHC/Data/Maybe.hs
+++ b/compiler/GHC/Data/Maybe.hs
@@ -26,10 +26,11 @@ module GHC.Data.Maybe (
) where
import GHC.Prelude
+import GHC.IO (catchException)
import Control.Monad
import Control.Monad.Trans.Maybe
-import Control.Exception (catch, SomeException(..))
+import Control.Exception (SomeException(..))
import Data.Maybe
import Data.Foldable ( foldlM )
import GHC.Utils.Misc (HasCallStack)
@@ -93,7 +94,7 @@ liftMaybeT act = MaybeT $ Just `liftM` act
-- | Try performing an 'IO' action, failing on error.
tryMaybeT :: IO a -> MaybeT IO a
-tryMaybeT action = MaybeT $ catch (Just `fmap` action) handler
+tryMaybeT action = MaybeT $ catchException (Just `fmap` action) handler
where
handler (SomeException _) = return Nothing