module UnliftIO.Environment
( getArgs
, getProgName
, getExecutablePath
, getEnv
, lookupEnv
, setEnv
, unsetEnv
, withArgs
, withProgName
, getEnvironment
) where
import Control.Monad.IO.Unlift
import qualified System.Environment as E
{-# INLINE getArgs #-}
getArgs :: MonadIO m => m [String]
getArgs = liftIO E.getArgs
{-# INLINE getProgName #-}
getProgName :: MonadIO m => m String
getProgName = liftIO E.getProgName
{-# INLINE getExecutablePath #-}
getExecutablePath :: MonadIO m => m FilePath
getExecutablePath = liftIO E.getExecutablePath
{-# INLINE getEnv #-}
getEnv :: MonadIO m => String -> m String
getEnv = liftIO . E.getEnv
{-# INLINE lookupEnv #-}
lookupEnv :: MonadIO m => String -> m (Maybe String)
lookupEnv = liftIO . E.lookupEnv
{-# INLINE setEnv #-}
setEnv :: MonadIO m => String -> String -> m ()
setEnv key_ value_ = liftIO (E.setEnv key_ value_)
{-# INLINE unsetEnv #-}
unsetEnv :: MonadIO m => String -> m ()
unsetEnv = liftIO . E.unsetEnv
{-# INLINE withArgs #-}
withArgs :: MonadUnliftIO m => [String] -> m a -> m a
withArgs xs act = withRunInIO (\u -> E.withArgs xs (u act))
{-# INLINE withProgName #-}
withProgName :: MonadUnliftIO m => String -> m a -> m a
withProgName nm act = withRunInIO (\u -> E.withProgName nm (u act))
{-# INLINE getEnvironment #-}
getEnvironment :: MonadIO m => m [(String, String)]
getEnvironment = liftIO E.getEnvironment