fold
inline fun <Ok : Any, Error : Any, Output> Outcome<Ok, Error>.fold(success: (Ok) -> Output, failure: (Error) -> Output): Output
Fold
the caller into some Output.
If Output is Outcome,
fold
can be used toflatMap
both outcomes.Use collapse to assume the nearest common
Ancestor
as the Output type.
Receiver
The Outcome to collapse.
Return
The collapsed value of type Output.
Parameters
Ok
The type of the Outcome.Success value.
Error
The type of the Outcome.Failure error.
success
The lambda to transform the Outcome.Success value into Output.
failure
The lambda to transform the Outcome.Failure error into Output.
See also
collapse