traverse takes an element and a map, and returns another element and a new (updated) map.
Given a list of elements
xs0 and an initial map
m0, I need to apply
traverse to each element of the list while passing in the updated map to each new invocation of
traverse, to produce a list of resulting elements and the last returned map:
foldr (\x (xs, m) -> let (x', m') = traverse x m in (x':xs, m')) (, m0) xs0
Is there a way to reduce all this clutter and use prelude as much as possible?