module Prolude.Exception
(
module Control.Exception.Safe
, UnsafeException.AsyncException(..)
, catchIf
, unsafeEvaluate
, unsafeThrow
)
where
import qualified Control.Exception as UnsafeException
import Control.Exception.Safe hiding (catchIO, throwM)
unsafeEvaluate :: a -> IO a
unsafeEvaluate :: forall a. a -> IO a
unsafeEvaluate = forall a. a -> IO a
UnsafeException.evaluate
unsafeThrow :: Exception e => e -> a
unsafeThrow :: forall e a. Exception e => e -> a
unsafeThrow = forall a e. Exception e => e -> a
UnsafeException.throw
catchIf :: (MonadCatch m, Exception e) => (e -> Bool) -> m a -> (e -> m a) -> m a
catchIf :: forall (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
(e -> Bool) -> m a -> (e -> m a) -> m a
catchIf e -> Bool
f m a
a e -> m a
b = forall (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
m a -> (e -> m a) -> m a
catch m a
a forall a b. (a -> b) -> a -> b
$ \e
e -> if e -> Bool
f e
e then e -> m a
b e
e else forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throw e
e