sequence method
Run the computations in sequence
Implementation
FutureOr<Either<L, IList<Tuple2<dynamic, S>>>> sequence(
Iterable<StateReaderTaskEither<S, C, L, dynamic>> arr,
) =>
arr.fold<FutureOr<Either<L, IList<Tuple2<dynamic, S>>>>>(
E.right(IList()),
(acc, _) => acc.flatMap(E.fold(
(l) => E.left(l),
(list) => run(_).flatMap(E.fold(
(l) => E.left(l),
(a) => E.right(list.add(a)),
)),
)),
);