mapAccumL package:infinite-list

Fold an infinite list from the left and return a list of successive reductions, keeping accumulator in a state:
mapAccumL f acc0 (x1 :< x2 :< ...) =
let (acc1, y1) = f acc0 x1 in
let (acc2, y2) = f acc1 x2 in
...
y1 :< y2 :< ...
If you are looking how to traverse with a state, look no further.