orElse<TL> method

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

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

Implementation

ReaderTaskEither<E, TL, R> orElse<TL>(
  ReaderTaskEither<E, TL, R> Function(L l) orElse,
) =>
    ReaderTaskEither((env) async => (await run(env)).match(
          (l) => orElse(l).run(env),
          (r) => ReaderTaskEither<E, TL, R>.of(r).run(env),
        ));