cwd : Task Path [CwdUnavailable]

Reads the current working directory from the environment. File operations on relative Paths are relative to this directory.

setCwd : Path -> Task {} [InvalidCwd]

Sets the current working directory in the environment. After changing it, file operations on relative Paths will be relative to this directory.

exePath : Task Path [ExePathUnavailable]

Gets the path to the currently-running executable.

var : Str -> Task Str [VarNotFound]

Reads the given environment variable.

If the value is invalid Unicode, the invalid parts will be replaced with the Unicode replacement character ('�').

decode : Str -> Task val [ VarNotFound, DecodeErr DecodeError ] where val implements Decoding

Reads the given environment variable and attempts to decode it.

The type being decoded into will be determined by type inference. For example, if this ends up being used like a Task U16 _ then the environment variable will be decoded as a string representation of a U16. Trying to decode into any other type will fail with a DecodeErr.

Supported types include;

For example, consider we want to decode the environment variable NUM_THINGS;

# Reads "NUM_THINGS" and decodes into a U16
getU16Var : Str -> Task U16 [VarNotFound, DecodeErr DecodeError] [Read [Env]]
getU16Var = \var -> Env.decode var

If NUM_THINGS=123 then getU16Var succeeds with the value of 123u16. However if NUM_THINGS=123456789, then getU16Var will fail with DecodeErr because 123456789 is too large to fit in a U16.

list : Task (List ( Str, Str )) *

Reads all the process's environment variables into a List (Str, Str).

If any key or value contains invalid Unicode, the Unicode replacement character will be used in place of any parts of keys or values that are invalid Unicode.