Skip to main content
Version: Next

option

The module of optional values

let value: <a>(_: a) => (_: option<a>) => a

The call value(d, opt) is v if opt is Some(v), and d otherwise.

let value_with_error: <err, a>(_: err) => (_: option<a>) => a

The call value_with_error(err, opt) terminates with the error err if, and only if, opt is None(); otherwise it is Some(v) and v is returned.

let value_exn: <err, a>(_: err) => (_: option<a>) => a

**Deprecated:** Use `Option.value_with_error` instead.

The call value_exn(err, opt) terminates with the error err if, and only if, opt is None(); otherwise it is Some(v) and v is returned.

let unopt_with_error: <a>(_: option<a>) => (_: string) => a

**Deprecated:** Use `Option.value_with_error` instead.

The call unopt_with_error(opt, err) terminates with the error err if, and only if, opt is None(); otherwise it is Some(v) and v is returned.

let unopt: <a>(_: option<a>) => a

**Deprecated:** Use `Option.value_with_error` instead.

The call unopt(opt) terminates with the string "option is None" if, and only if, opt is None(); otherwise it is Some(v) and v is returned.

let map: <a, b>(_: (_: a) => b) => (_: option<a>) => option<b>

The call map(f, opt) is None() if opt is None(), and Some(f(v)) if opt is Some(v).

let is_none: <a>(_: option<a>) => bool

The call is_none(opt) is true if, and only if, opt is None().

let is_some: <a>(_: option<a>) => bool

The call is_some(opt) is false if, and only if, opt is None().