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 :: forall (m :: * -> *). MonadIO m => m [String]
getArgs = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO [String]
E.getArgs
{-# INLINE getProgName #-}
getProgName :: MonadIO m => m String
getProgName :: forall (m :: * -> *). MonadIO m => m String
getProgName = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO String
E.getProgName
{-# INLINE getExecutablePath #-}
getExecutablePath :: MonadIO m => m FilePath
getExecutablePath :: forall (m :: * -> *). MonadIO m => m String
getExecutablePath = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO String
E.getExecutablePath
{-# INLINE getEnv #-}
getEnv :: MonadIO m => String -> m String
getEnv :: forall (m :: * -> *). MonadIO m => String -> m String
getEnv = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> IO String
E.getEnv
{-# INLINE lookupEnv #-}
lookupEnv :: MonadIO m => String -> m (Maybe String)
lookupEnv :: forall (m :: * -> *). MonadIO m => String -> m (Maybe String)
lookupEnv = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> IO (Maybe String)
E.lookupEnv
{-# INLINE setEnv #-}
setEnv :: MonadIO m => String -> String -> m ()
setEnv :: forall (m :: * -> *). MonadIO m => String -> String -> m ()
setEnv String
key_ String
value_ = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (String -> String -> IO ()
E.setEnv String
key_ String
value_)
{-# INLINE unsetEnv #-}
unsetEnv :: MonadIO m => String -> m ()
unsetEnv :: forall (m :: * -> *). MonadIO m => String -> m ()
unsetEnv = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> IO ()
E.unsetEnv
{-# INLINE withArgs #-}
withArgs :: MonadUnliftIO m => [String] -> m a -> m a
withArgs :: forall (m :: * -> *) a. MonadUnliftIO m => [String] -> m a -> m a
withArgs [String]
xs m a
act = forall (m :: * -> *) b.
MonadUnliftIO m =>
((forall a. m a -> IO a) -> IO b) -> m b
withRunInIO (\forall a. m a -> IO a
u -> forall a. [String] -> IO a -> IO a
E.withArgs [String]
xs (forall a. m a -> IO a
u m a
act))
{-# INLINE withProgName #-}
withProgName :: MonadUnliftIO m => String -> m a -> m a
withProgName :: forall (m :: * -> *) a. MonadUnliftIO m => String -> m a -> m a
withProgName String
nm m a
act = forall (m :: * -> *) b.
MonadUnliftIO m =>
((forall a. m a -> IO a) -> IO b) -> m b
withRunInIO (\forall a. m a -> IO a
u -> forall a. String -> IO a -> IO a
E.withProgName String
nm (forall a. m a -> IO a
u m a
act))
{-# INLINE getEnvironment #-}
getEnvironment :: MonadIO m => m [(String, String)]
getEnvironment :: forall (m :: * -> *). MonadIO m => m [(String, String)]
getEnvironment = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO [(String, String)]
E.getEnvironment