sequence<S, A> function

State<S, IList<A>> sequence<S, A>(
  1. Iterable<State<S, A>> states
)

Implementation

State<S, IList<A>> sequence<S, A>(Iterable<State<S, A>> states) =>
    State((s) => states.fold(tuple2(IList(), s), (acc, f) {
          final next = f(acc.second);
          return tuple2(acc.first.add(next.first), next.second);
        }));