sequence<S, A> function
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);
}));