HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

ModuleCabal-3.12.1.0Haskell2010

Distribution.Compat.Environment

  • 4 values
  • PackageCabal-3.12.1.0
  • Exports4
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceEnvironment.hs
valuelookupEnv :: String -> IO (Maybe String)
#

Return the value of the environment variable var, or Nothing if there is no such value.

For POSIX users, this is equivalent to getEnv.

valuesetEnv :: String -> String -> IO ()
#

setEnv name value sets the specified environment variable to value.

Throws IOException if either name or value is the empty string or contains an equals sign.

valueunsetEnv :: String -> IO ()
#

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.