either(Result, Reason) = {ok, Result} | {error, Reason}
and_/1 | Fold over a term that depend on a previous result. |
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. |
traverse/2 | Collect results of applying either-returning function on inputs. |
with_default/2 |
Fold over a term that depend on a previous result
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.
traverse(F, Xs::[A]) -> either([Result], Reason)
Collect results of applying either-returning function on inputs.
We'll bail out with the error on the first item for which the function errors out. If the function returns an ok value for all inputs, the result will contain those values collected in a single result.with_default(X1::either(Result, Reason), Default) -> Result | Default
Generated by EDoc