traverseIterableSeq<L, A, B> function

TaskEither<L, IList<B>> Function(Iterable<A>) traverseIterableSeq<L, A, B>(
  1. TaskEither<L, B> f(
    1. A a
    )
)

Implementation

TaskEither<L, IList<B>> Function(Iterable<A>) traverseIterableSeq<L, A, B>(
  TaskEither<L, B> Function(A a) f,
) =>
    (as) => TaskEither(Task(() => as.fold<FutureOr<Either<L, IList<B>>>>(
          either.right(IList()),
          (acc, a) => acc.flatMap(
            (eb) => eb.chain(
              either.fold(
                (_) => acc,
                (bs) => f(a)().flatMap(either.fold(
                  (l) => either.left(l),
                  (b) => either.right(bs.add(b)),
                )),
              ),
            ),
          ),
        )));