maybe library


The Maybe type encapsulates an optional value. A value of type Maybe<T> either contains a value of type T (built with Maybe<T>.just), or it is empty (built with Maybe<T>.nothing).
MaybeMap<K, V>
A map with optional values. [...]


isNothing<T>(Maybe<T> maybe) bool
Tests if maybe is nothing.
isSome<T>(Maybe<T> maybe) bool
Tests if maybe is some.
mapSome<T, U>(Maybe<T> maybe, U converter(T v)) Maybe<U>
Converts maybe from Maybe<T> to Maybe<U>. [...]
some<T>(Maybe<T> maybe, T defaultValue) → T
Extracts value from maybe if not nothing, else returns defaultValue.
when<T>(Maybe<T> maybe, {MaybeNothing nothing, MaybeSome<T> some, MaybeDefault<T> defaultValue}) → void
Tests the maybe status : executes some if it contains a value, whenNothing if not. [...]


MaybeDefault<T>() → T
MaybeNothing() → void
MaybeSome<T>(T value) → void