flatMapSuccess

infix inline fun <In, Out, Error> Outcome<In, Error>.flatMapSuccess(transform: (In) -> Outcome<Out, Error>): Outcome<Out, Error>

Transforms Outcome<In, Error> into Outcome<Out, Error> by applying transform to the Success value.

  • Failure outcomes pass through; the Error is re-wrapped to satisfy the new monad wrapper for Out.

  • Unlike mapSuccess, transform must return a full Outcome — the wrapper is not added for you.

  • No error handling is provided.

Parameters

transform

Converts the Success value into an Outcome.

See also