{-# LANGUAGE Safe #-}
module Universum.Lifted.Env
( exitWith
, exitFailure
, exitSuccess
, die
) where
import Control.Monad.Trans (MonadIO, liftIO)
import Data.String (String)
import Prelude ((>>))
import System.Exit (ExitCode)
import System.IO (stderr)
import qualified System.Exit as XIO
import qualified System.IO (hPutStrLn)
exitWith :: MonadIO m => ExitCode -> m a
exitWith a = liftIO (XIO.exitWith a)
{-# INLINE exitWith #-}
exitFailure :: MonadIO m => m a
exitFailure = liftIO XIO.exitFailure
{-# INLINE exitFailure #-}
exitSuccess :: MonadIO m => m a
exitSuccess = liftIO XIO.exitSuccess
{-# INLINE exitSuccess #-}
die :: MonadIO m => String -> m a
die err = liftIO (System.IO.hPutStrLn stderr err) >> exitFailure
{-# INLINE die #-}