+{-# LANGUAGE NoImplicitPrelude
+ , BangPatterns
+ , RankNTypes
+ , MagicHash
+ , UnboxedTuples
+ #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
-{-# LANGUAGE NoImplicitPrelude, BangPatterns, RankNTypes #-}
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
-- |
catchException (IO io) handler = IO $ catch# io handler'
where handler' e = case fromException e of
Just e' -> unIO (handler e')
- Nothing -> raise# e
+ Nothing -> raiseIO# e
catchAny :: IO a -> (forall e . Exception e => e -> IO a) -> IO a
catchAny (IO io) handler = IO $ catch# io handler'
1# -> MaskedUninterruptible
_ -> MaskedInterruptible #)
+{-# DEPRECATED blocked "use Control.Exception.getMaskingState instead" #-}
-- | returns True if asynchronous exceptions are blocked in the
-- current thread.
blocked :: IO Bool
onException :: IO a -> IO b -> IO a
onException io what = io `catchException` \e -> do _ <- what
- throw (e :: SomeException)
+ throwIO (e :: SomeException)
-- | Executes an IO computation with asynchronous
-- exceptions /masked/. That is, any thread which attempts to raise