package eio

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Process.EnvSource

A list of environment variable entries.

By convention, the entries are strings of the form "name=value", each name is unique, order doesn't matter, and "" is not a valid name.

Also, due to the representation:

  • Names cannot contain the '=' character.
  • Neither names nor values can contain '\000'.

On Windows, name comparison is (ASCII) case-insensitive. The convention of always using uppercase ASCII names for environment variables will avoid different behaviour across platforms.

  • since 1.6
Sourcetype t = string array

Note: this type is currently exposed for backwards compatibility and will likely be made abstract in the future. The array is intended to be immutable.

Sourceval empty : t

An environment with no bindings.

Sourceval of_bindings : (string * string) list -> t

of_bindings xs is a new environment containing only the bindings in xs.

This just adds xs to empty using override.

Sourceval get_opt : string -> t -> string option

get_opt name t is the value of name in t, or None if there is no such binding (or if name is not a valid name).

Sourceval override : (string * string option) list -> t -> t

override bindings t is a new environment which is like t except that the updates in bindings have been applied.

Each entry in bindings is a (name, new_value) pair. new_value can be None to remove name (ignored if name is not present).

If there are several bindings for the same name in bindings then the last one is used. If there are several bindings for an updated name in t then all are removed first.

Sourceval of_array : string array -> t

Create a t from e.g. the results of Unix.environment.

The bindings are used as-is and need not conform to the conventions (e.g. they may contain duplicate names).

Note: the array is assumed to be immutable.

Sourceval to_array : t -> string array

to_array t gets t as an array. The array should be treated as immutable.

Sourceval pp : t Fmt.t