map Success
infix inline fun <In : Any, Out : Any, Error : Any> Outcome<In, Error>.mapSuccess(transform: (In) -> Out): Outcome<Out, Error>
Returns a new Outcome, after applying transform to the Outcome.Success value.
Transforms
Outcome<In, Error>
intoOutcome<Out, Error>
.If the receiver Outcome is an Outcome.Failure, the
Error
is simply re-wrapped to update theOk
type.This function does not provide a RaiseScope, and makes no guarantees about catching, handling, or rethrowing errors! Use andThen or outcomeOf within the transformation lambda for that.
Unlike flatMapSuccess, mapSuccess's transform lambda returns the monad's internal value directly instead of the Outcome wrapper.
Receiver
Return
Parameters
In
The Ok
type of the receiver Outcome.
Out
The Ok
type of the returned Outcome.
Error
The Error
type of Outcome.Failure.