Proposal: Non-allocating way to iterate over a Data.Map: traverseWithKey_

Sjoerd Visscher sjoerd at
Sun Aug 4 13:48:03 CEST 2013

On Aug 4, 2013, at 9:49 AM, Milan Straka <fox at> wrote:

> The problem is that
> Data.Foldable offers many non-overloadable methods that are provided
> through the Foldable instance, notably
> traverse_
> foldrM
> foldlM
> which could be implemented so that they iterate over all elements
> without allocating, but the Data.Foldable implementation allocates and
> cannot be overloaded.

Would it help if traverse_ was implemented with foldMap using the Traverse_ newtype? In which case maybe we should fix Data.Foldable!


More information about the Libraries mailing list