{-# 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 :: ExitCode -> m a
exitWith ExitCode
a = IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (ExitCode -> IO a
forall a. ExitCode -> IO a
XIO.exitWith ExitCode
a)
{-# INLINE exitWith #-}
exitFailure :: MonadIO m => m a
exitFailure :: m a
exitFailure = IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO a
forall a. IO a
XIO.exitFailure
{-# INLINE exitFailure #-}
exitSuccess :: MonadIO m => m a
exitSuccess :: m a
exitSuccess = IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO a
forall a. IO a
XIO.exitSuccess
{-# INLINE exitSuccess #-}
die :: MonadIO m => String -> m a
die :: String -> m a
die String
err = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (Handle -> String -> IO ()
System.IO.hPutStrLn Handle
stderr String
err) m () -> m a -> m a
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> m a
forall (m :: * -> *) a. MonadIO m => m a
exitFailure
{-# INLINE die #-}