haskell/containers — pull request #24 by ekmett (2012-12-25 11:04:35+00:00)
Title: Added `foldMapWithKey`.

I've needed this repeatedly over the years and it makes an asymptotic difference in parts of ekmett/lens, so I figured I'd submit it.

This is asymptotically more efficient than using `fold . mapWithKey` for many monoids because it doesn't have to build up an entire new map just to `foldMap` it.

There isn't a sensible strict variant.