orElse<TL> method

IOEither<TL, R> orElse<TL>(
  1. IOEither<TL, R> orElse(
    1. L l
    )
)

When this IOEither returns a Left then return the result of orElse. Otherwise return this IOEither.

Implementation

IOEither<TL, R> orElse<TL>(IOEither<TL, R> Function(L l) orElse) =>
    IOEither(() => run().match(
        (l) => orElse(l).run(), (r) => IOEither<TL, R>.right(r).run()));