traverseState<B, S> method
Implementation
State<S, IList<B>> traverseState<B, S>(State<S, B> f(A a)) {
State<S, IList<B>> result = new State((s) => tuple2(nil(), s));
var current = this;
while(current._isCons()) {
final gb = f(current._unsafeHead());
result = result.flatMap((a) => gb.map((h) => new Cons(h, a)));
current = current._unsafeTail();
}
return result.map((l) => l.reverse());
}