std/core/maybe2▲toc

Standard maybe2std/core/types/maybe2: (V, V) -> V functions which, unlike maybestd/core/types/maybe: V -> V, can contain 2 values to avoid boxing allocations.

.

fun (==)( mb1 : maybe2std/core/types/maybe2: (V, V) -> V<a,b>, mb2 : maybe2std/core/types/maybe2: (V, V) -> V<a,b>, ?fst/(==) : (a, a) -> boolstd/core/types/bool: V, ?snd/(==) : (b, b) -> boolstd/core/types/bool: V ) : boolstd/core/types/bool: V

Equality on maybestd/core/types/maybe: V -> V.

fun (||)( m1 : maybe2std/core/types/maybe2: (V, V) -> V<a,b>, m2 : maybe2std/core/types/maybe2: (V, V) -> V<a,b> ) : maybe2std/core/types/maybe2: (V, V) -> V<a,b>
fun bool( mb : maybe2std/core/types/maybe2: (V, V) -> V<a,b> ) : boolstd/core/types/bool: V

Convert a maybe2std/core/types/maybe2: (V, V) -> V type to a boolean, equivalent to is-just2std/core/types/is-just2: forall<a,b> (maybe2 : maybe2<a,b>) -> bool.

fun cmp( mb1 : maybe2std/core/types/maybe2: (V, V) -> V<a,b>, mb2 : maybe2std/core/types/maybe2: (V, V) -> V<a,b>, ?fst/cmp : (a, a) -> orderstd/core/types/order: V, ?snd/cmp : (b, b) -> orderstd/core/types/order: V ) : orderstd/core/types/order: V

Order on maybestd/core/types/maybe: V -> V values.

fun default( m : maybe2std/core/types/maybe2: (V, V) -> V<a,b>, nothing : (a, b) ) : (a, b)

Convert a maybe2<a,b> value to (a,b), using the nothing parameter for Nothing2std/core/types/Nothing2: forall<a,b> maybe2<a,b>.

fun expect( m : maybe2std/core/types/maybe2: (V, V) -> V<a,b>, error-msg : stringstd/core/types/string: V ) : exnstd/core/exn/exn: (E, V) -> V (a, b)

Get the value of the Juststd/core/types/Just: forall<a> (value : a) -> maybe<a> constructor or raise an exception.

fun map( m : maybe2std/core/types/maybe2: (V, V) -> V<a,b>, f : (a, b) -> e (c, d) ) : e maybe2std/core/types/maybe2: (V, V) -> V<c,d>
fun maybe2( m : maybe2std/core/types/maybe2: (V, V) -> V<a,b>, onNothing : c, onJust : (a, b) -> e c ) : e c

Match a maybe2std/core/types/maybe2: (V, V) -> V value and either return a default value on Nothing2std/core/types/Nothing2: forall<a,b> maybe2<a,b> or apply a function to the value on Just2std/core/types/Just2: forall<a,b> (fst : a, snd : b) -> maybe2<a,b>.

fun show( mb : maybe2std/core/types/maybe2: (V, V) -> V<a,b>, ?fst/show : (a) -> e stringstd/core/types/string: V, ?snd/show : (b) -> e stringstd/core/types/string: V ) : e stringstd/core/types/string: V

Show a maybe2std/core/types/maybe2: (V, V) -> V type.

fun unjust( m : maybe2std/core/types/maybe2: (V, V) -> V<a,b>, ?kk-file-line : stringstd/core/types/string: V ) : exnstd/core/exn/exn: (E, V) -> V (a, b)

Get the value of the Juststd/core/types/Just: forall<a> (value : a) -> maybe<a> constructor or raise an exception.

private import std/core/typesstd/core/types, std/core/hndstd/core/hnd, std/core/exnstd/core/exn