|Copyright||(c) Habib Alamin 2017|
|License||BSD-style (see the file libraries/base/LICENSE)|
A setEnv implementation that allows blank environment variables. Mimics the
Env module from the
unix package, but with support for Windows too.
The matrix of platforms that:
putenv(FOO)to unset environment variables,
putenv("FOO=")to unset environment variables or set them to blank values,
unsetenvto unset environment variables,
setenvto set environment variables,
is very complicated. Some platforms don't support unsetting of environment variables at all.
Returns the absolute pathname of the current executable.
Note that for scripts and interactive sessions, this is the path to the interpreter (e.g. ghci.)
getArgs returns a list of the program's command line arguments (not including the program name).
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.
getEnvironment retrieves the entire environment as a list of
If an environment entry does not contain an
'=' character, the
key is the whole entry and the
value is the empty string.
|-> IO String||
variable value or fallback value
Get an environment value or a default value.
unsetEnv, but allows for the removal of blank environment variables. May throw an exception if the underlying platform doesn't support unsetting of environment variables.
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).