{-# LANGUAGE CPP #-}
module Distribution.Compat.Exception (
catchIO,
catchExit,
tryIO,
displayException,
) where
#ifdef MIN_VERSION_base
#define MINVER_base_48 MIN_VERSION_base(4,8,0)
#else
#define MINVER_base_48 (__GLASGOW_HASKELL__ >= 710)
#endif
import System.Exit
import qualified Control.Exception as Exception
#if MINVER_base_48
import Control.Exception (displayException)
#endif
tryIO :: IO a -> IO (Either Exception.IOException a)
tryIO :: forall a. IO a -> IO (Either IOException a)
tryIO = forall e a. Exception e => IO a -> IO (Either e a)
Exception.try
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
catchIO :: forall a. IO a -> (IOException -> IO a) -> IO a
catchIO = forall e a. Exception e => IO a -> (e -> IO a) -> IO a
Exception.catch
catchExit :: IO a -> (ExitCode -> IO a) -> IO a
catchExit :: forall a. IO a -> (ExitCode -> IO a) -> IO a
catchExit = forall e a. Exception e => IO a -> (e -> IO a) -> IO a
Exception.catch
#if !MINVER_base_48
displayException :: Exception.Exception e => e -> String
displayException = show
#endif