crow/option.crow (source)

new[t] t?() bare

Empty option.

new[t] t?(a t) bare

Option containing a.

==[t] bool(a t?, b t?) bare, t equal

<=>[t] comparison(a t?, b t?) bare, t compare

is-empty[t] bool(a t?) bare

True iff a is an empty option.

size[t] nat64(a t?) bare

1 if a has a value, else 0.

||[t] t?(a t?, b t?) bare

Lazily-evaluated.
If a is non-empty, returns it and does not evaluate b.
Else, returns b.

??[t] t(a t?, default t) bare

Lazily-evaluated.
If a is non-empty, returns its value and does not evaluate b.
Else, returns b.

force[t] t(a t?) bare

Called like 'a!'
If a is non-empty, returns its value; else throws.

force-option-error record exception variant-member

    show string(anonymous force-option-error)

    option[t] union

    Optional type. Read the tutorial to learn more.

    You never need to match on this union; use the if x ?= y syntax instead.