Movatterモバイル変換


[0]ホーム

URL:


base-4.12.0.0: Basic libraries

Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

System.Environment

Description

Miscellaneous information about the system environment.

Synopsis

Documentation

getArgs ::IO [String]Source#

ComputationgetArgs returns a list of the program's command line arguments (not including the program name).

getProgName ::IOStringSource#

ComputationgetProgName returns the name of the program as it wasinvoked.

However, this is hard-to-impossible to implement on some non-UnixOSes, so instead, for maximum portability, we just return the leafnameof the program as invoked. Even then there are some differencesbetween platforms: on Windows, for example, a program invoked as foois probably reallyFOO.EXE, and that is whatgetProgName will return.

getExecutablePath ::IOFilePathSource#

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.)

Since base 4.11.0.0,getExecutablePath resolves symlinks on Windows. If an executable is launched through a symlink,getExecutablePath returns the absolute path of the original executable.

Since: 4.6.0.0

getEnv ::String ->IOStringSource#

ComputationgetEnvvar returns the value of the environment variablevar. For the inverse, thesetEnv function can be used.

This computation may fail with:

lookupEnv ::String ->IO (MaybeString)Source#

Return the value of the environment variablevar, orNothing if there is no such value.

For POSIX users, this is equivalent togetEnv.

Since: 4.6.0.0

setEnv ::String ->String ->IO ()Source#

setEnv name value sets the specified environment variable tovalue.

Early versions of this function operated under the mistaken belief that setting an environment variable to theempty 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, usesetEnv.

ThrowsIOException ifname is the empty string or contains an equals sign.

Since: 4.7.0.0

unsetEnv ::String ->IO ()Source#

unsetEnv name removes the specified environment variable from the environment of the current process.

ThrowsIOException ifname is the empty string or contains an equals sign.

Since: 4.7.0.0

withArgs :: [String] ->IO a ->IO aSource#

withArgsargs act - while executing actionact, havegetArgsreturnargs.

withProgName ::String ->IO a ->IO aSource#

withProgNamename act - while executing actionact,havegetProgName returnname.

getEnvironment ::IO [(String,String)]Source#

getEnvironment retrieves the entire environment as a list of(key,value) pairs.

If an environment entry does not contain an'=' character, thekey is the whole entry and thevalue is the empty string.

Produced byHaddock version 2.20.0


[8]ページ先頭

©2009-2025 Movatter.jp