either(Result, Reason) = {ok, Result} | {error, Reason}
fold/2 | Fold over a term with a list of functions. |
from_bool/3 | Convert a boolean to the form {ok, Result} or {error, Reason} . |
is_error/1 | Check whether the given result tuple is of the form {error, Reason} . |
is_ok/1 | Check whether the given result tuple is of the form {ok, Result} . |
oks/1 | Collect the ok values from a list of result tuples. |
sequence/1 | Combine a list of result tuples. |
with_default/2 |
fold(Init::term(), Fs::[fun((Result) -> Return)]) -> either(Result, Reason)
Fold over a term with a list of functions.
The first function in the list is called with the initial value, and
expected to produce either an either(Result, Reason)
or a bare
Result
. If the produced value is an {ok, Result}
tuple, the
next function is called with Result
as its input. If the produced
value is a bare Result
, the next function is called with that
value as its input. If the produced value is an error, processing
stops and returns that {error, Reason}
tuple.
from_bool(Result, Reason, X3::boolean()) -> either(Result, Reason)
Convert a boolean to the form {ok, Result}
or {error, Reason}
.
is_error(X1::either(Result, Reason)) -> boolean()
Check whether the given result tuple is of the form {error, Reason}
.
is_ok(X1::either(Result, Reason)) -> boolean()
Check whether the given result tuple is of the form {ok, Result}
.
oks(Eithers::[either(Result, Reason)]) -> [Result]
Collect the ok
values from a list of result tuples.
sequence(Eithers::[either(Result, Reason)]) -> either([Result], Reason)
Combine a list of result tuples.
This will result in either an{error, Reason}
if any of the supplied
tuples is an error, or {ok, [Result]}
with all the ok-values sequenced
into a list.
with_default(X1::either(Result, Reason), Default) -> Result | Default
Generated by EDoc