redeem<B> method

IO<B> redeem<B>(
  1. Function1<RuntimeException, B> recover,
  2. Function1<A, B> map
)

Returns the value created from recover or map, depending on whether this IO results in an error or is successful.

Implementation

IO<B> redeem<B>(
        Function1<RuntimeException, B> recover, Function1<A, B> map) =>
    attempt().map((a) => a.fold(recover, map));