match<A> method

Task<A> match<A>(
  1. A onLeft(
    1. L l
    ),
  2. A onRight(
    1. R r
    )
)

Pattern matching to convert a TaskEither to a Task.

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

Implementation

Task<A> match<A>(A Function(L l) onLeft, A Function(R r) onRight) =>
    Task(() async => (await run()).match(onLeft, onRight));