option
The module of optional values
let value: <a>(_: a) => (_: option<a>) => a
The call Option.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 Option.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 Option.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 Option.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 Option.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 Option.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 Option.is_none(opt)
is true
if, and only if, opt
is
None()
.
let is_some: <a>(_: option<a>) => bool
The call Option.is_some(opt)
is false
if, and only if, opt
is
None()
.