match<B> method

ReaderTask<E, B> match<B>(
  1. B onLeft(
    1. L left
    ),
  2. B onRight(
    1. R right
    )
)

Pattern matching to convert a ReaderTaskEither to a ReaderTask.

Execute onLeft when running this ReaderTaskEither returns a Left. Otherwise execute onRight.

Implementation

ReaderTask<E, B> match<B>(
  B Function(L left) onLeft,
  B Function(R right) onRight,
) =>
    ReaderTask(
      (env) async => (await run(env)).match(
        onLeft,
        onRight,
      ),
    );