Module System.Environment

Library to access parts of the system environment.

Category
general
Author
Michael Hanus, Bernd Brassel, Bjoern Peemoeller
Version
November 2020

Exported Functions: getArgs, getEnv, getHostname, getProgName, isPosix, isWindows, setEnv, unsetEnv


Exported Functions


getArgs :: IO [String]  Deterministic 

Returns the list of the program's command line arguments. The program name is not included.

Further infos:
  • externally defined

getEnv :: String -> IO String  Deterministic 

Returns the value of an environment variable. The empty string is returned for undefined environment variables.


setEnv :: String -> String -> IO ()  Deterministic 

Set an environment variable to a value. The new value will be passed to subsequent shell commands (see codesystem/code) and visible to subsequent calls to codegetEnv/code (but it is not visible in the environment of the process that started the program execution).


unsetEnv :: String -> IO ()  Deterministic 

Removes an environment variable that has been set by codesetEnv/code.


getHostname :: IO String  Deterministic 

Returns the hostname of the machine running this process.

Further infos:
  • externally defined

getProgName :: IO String  Deterministic 

Returns the name of the current program, i.e., the name of the main module currently executed.

Further infos:
  • externally defined

isPosix :: Bool  Deterministic 

Is the underlying operating system a POSIX system (unix, MacOS)?


isWindows :: Bool  Deterministic 

Is the underlying operating system a Windows system?

Further infos:
  • externally defined