Portability | non-portable (requires POSIX) |
---|---|
Stability | provisional |
Maintainer | libraries@haskell.org |
Safe Haskell | Trustworthy |
POSIX environment support
- getEnv :: String -> IO (Maybe String)
- getEnvDefault :: String -> String -> IO String
- getEnvironmentPrim :: IO [String]
- getEnvironment :: IO [(String, String)]
- setEnvironment :: [(String, String)] -> IO ()
- putEnv :: String -> IO ()
- setEnv :: String -> String -> Bool -> IO ()
- unsetEnv :: String -> IO ()
- clearEnv :: IO ()
Documentation
getEnvDefault :: String -> String -> IO StringSource
getEnvDefault
is a wrapper around getEnv
where the
programmer can specify a fallback if the variable is not found
in the environment.
getEnvironment :: IO [(String, String)]Source
getEnvironment
retrieves the entire environment as a
list of (key,value)
pairs.
setEnvironment :: [(String, String)] -> IO ()Source
setEnvironment
resets the entire environment to the given list of
(key,value)
pairs.
putEnv :: String -> IO ()Source
putEnv
function takes an argument of the form name=value
and is equivalent to setEnv(key,value,True{-overwrite-})
.
setEnv :: String -> String -> Bool -> IO ()Source
The setEnv
function inserts or resets the environment variable name in
the current environment list. If the variable name
does not exist in the
list, it is inserted with the given value. If the variable does exist,
the argument overwrite
is tested; if overwrite
is False
, the variable is
not reset, otherwise it is reset to the given value.