never executed always true always false
1 {-# OPTIONS_GHC -fno-warn-deprecations #-}
2 {-# LANGUAGE ConstraintKinds #-}
3
4 module GHC.Utils.Exception
5 (
6 module CE,
7 module GHC.Utils.Exception
8 )
9 where
10
11 import GHC.Prelude
12
13 import GHC.IO (catchException)
14 import Control.Exception as CE hiding (assert)
15 import Control.Monad.IO.Class
16 import Control.Monad.Catch
17
18 -- Monomorphised versions of exception-handling utilities
19 catchIO :: IO a -> (IOException -> IO a) -> IO a
20 catchIO = catchException
21
22 handleIO :: (IOException -> IO a) -> IO a -> IO a
23 handleIO = flip catchIO
24
25 tryIO :: IO a -> IO (Either IOException a)
26 tryIO = CE.try
27
28 type ExceptionMonad m = (MonadCatch m, MonadThrow m, MonadMask m, MonadIO m)