traverseIterable<S, R, E, A, B> function
StateReaderTaskEither<S, R, E, IList<B> > Function(Iterable<A> )
traverseIterable<S, R, E, A, B>(
- StateReaderTaskEither<
S, R, E, B> f(- A a
Implementation
StateReaderTaskEither<S, R, E, IList<B>> Function(
Iterable<A>,
) traverseIterable<S, R, E, A, B>(
StateReaderTaskEither<S, R, E, B> Function(A a) f,
) =>
(as) => StateReaderTaskEither((s) => ReaderTaskEither((r) =>
TaskEither(Task(() => as.fold<FutureOr<Either<E, Tuple2<IList<B>, S>>>>(
Ei.right(tuple2(IList(), s)),
(acc, a) => acc.flatMap(Ei.fold(
(e) => acc,
(bs) => f(a)(bs.second)(r)().flatMap((eb) => eb.chain(Ei.fold(
(e) => Ei.left(e),
(t) => Ei.right(tuple2(bs.first.add(t.first), t.second)),
))),
)),
)))));