Computation getArgs returns a list of the program's command line arguments (not including the program name).
Modulebase-compat-0.14.1Haskell2010
System.Environment.Compat
Miscellaneous information about the system environment.
- 9 values
- Packagebase-compat-0.14.1
- Exports9
- LanguageHaskell2010
- LicenceMIT
- SourceCompat.hs
Computation getProgName returns the name of the program as it was invoked.
However, this is hard-to-impossible to implement on some non-Unix
OSes, so instead, for maximum portability, we just return the leafname
of the program as invoked. Even then there are some differences
between platforms: on Windows, for example, a program invoked as foo
is probably really FOO.EXE, and that is what getProgName will return.
Computation getEnv var returns the value
of the environment variable var. For the inverse, the
setEnv function can be used.
This computation may fail with:
isDoesNotExistError if the environment variable does not exist.
Return the value of the environment variable var, or Nothing if
there is no such value.
For POSIX users, this is equivalent to getEnv.
setEnv name value sets the specified environment variable to value.
Early versions of this function operated under the mistaken belief that setting an environment variable to the empty string on Windows removes that environment variable from the environment. For the sake of compatibility, it adopted that behavior on POSIX. In particular
setEnv name ""
has the same effect as
unsetEnv name
If you'd like to be able to set environment variables to blank strings, use setEnv.
Throws IOException if name is the empty string or
contains an equals sign.
Beware that this function must not be executed concurrently with getEnv, lookupEnv, getEnvironment and such. One thread reading environment variables at the same time with another one modifying them can result in a segfault, see Setenv is not Thread Safe for discussion.
unsetEnv name removes the specified environment variable from the
environment of the current process.
Throws IOException if name is the empty string or
contains an equals sign.
Beware that this function must not be executed concurrently with getEnv, lookupEnv, getEnvironment and such. One thread reading environment variables at the same time with another one modifying them can result in a segfault, see Setenv is not Thread Safe for discussion.
withProgName name act - while executing action act,
have getProgName return name.
getEnvironment retrieves the entire environment as a
list of (key,value) pairs.
If an environment entry does not contain an '=' character,
the key is the whole entry and the value is the empty string.