map
inline fun <In : Any, Out : Any, ErrorIn : Any, ErrorOut : Any> Outcome<In, ErrorIn>.map(success: (In) -> Out, failure: (ErrorIn) -> ErrorOut): Outcome<Out, ErrorOut>
Transform an Outcome with either success or failure.
Unlike, fold,
map
re-wraps each transform as the same kind of Outcome.This function does not provide a RaiseScope, and makes no guarantees about catching, handling, or rethrowing errors! Use andThen/tryRecover or outcomeOf within the transformation lambdas for that.
Receiver
Return
Parameters
In
The Ok
type of the receiver Outcome.
Out
The Ok
type of the returned Outcome.
Error In
The Error
type of the receiver Outcome.
Error Out
The Error
type of the returned Outcome.
success
The transform to apply if the receiver Outcome is an Outcome.Success.
failure
The transform to apply if the receiver Outcome is an Outcome.Failure.