doTaskEither<L, R> function

TaskEither<L, R> doTaskEither<L, R>(
  1. Future<R> f(
    1. Future<A> <A>(
      1. TaskEither<L, A>
      )
    )
)

Implementation

TaskEither<L, R> doTaskEither<L, R>(
  Future<R> Function(
    Future<A> Function<A>(TaskEither<L, A>),
  ) f,
) =>
    () async {
      try {
        return Right(
          await f(
            <A>(either) async => switch (await either()) {
              Right(value: final value) => value,
              Left(value: final value) => throw _EvalException(value)
            },
          ),
        );
      } on _EvalException<L> catch (e) {
        return Left(e.value);
      }
    };