{-# LANGUAGE CPP #-}

module Distribution.Compat.Exception
  ( catchIO
  , catchExit
  , tryIO
  , displayException
  ) where

import Control.Exception (displayException)
import qualified Control.Exception as Exception
import System.Exit

-- | Try 'IOException'.
tryIO :: IO a -> IO (Either Exception.IOException a)
tryIO :: forall a. IO a -> IO (Either IOException a)
tryIO = IO a -> IO (Either IOException a)
forall e a. Exception e => IO a -> IO (Either e a)
Exception.try

-- | Catch 'IOException'.
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
catchIO :: forall a. IO a -> (IOException -> IO a) -> IO a
catchIO = IO a -> (IOException -> IO a) -> IO a
forall e a. Exception e => IO a -> (e -> IO a) -> IO a
Exception.catch

-- | Catch 'ExitCode'
catchExit :: IO a -> (ExitCode -> IO a) -> IO a
catchExit :: forall a. IO a -> (ExitCode -> IO a) -> IO a
catchExit = IO a -> (ExitCode -> IO a) -> IO a
forall e a. Exception e => IO a -> (e -> IO a) -> IO a
Exception.catch