Containers and folds

Johan Tibell johan.tibell at
Sat Sep 25 09:41:53 EDT 2010

On Sat, Sep 25, 2010 at 2:41 PM, Ian Lynagh <igloo at> wrote:
> On Fri, Sep 24, 2010 at 07:09:56PM +0200, Milan Straka wrote:
>> I therefore propose to:
>> a) add foldrWithKey and foldlWithKey to IntMap, make foldWithKey
>>    deprecated and synonymous for foldrWithKey.
> Agree.
> Why not also add foldl and foldr to Map and IntMap, and deprecate fold?

I think having all these with and without key version of all the
functions in Data.{Map,Set} is a misstake. They don't improve
performance (I've checked) and they almost double the size of the API
(which is a whopping ~150 functions!). We probably* can't do much
about the functions already in the API, but lets discuss whether we
really want to continue that pattern.

* I'm working on a tool to check all of Hackage for use sites of
particular functions. If that tool shows that no one uses some of
these functions, we could consider removing them.

-- Johan

More information about the Libraries mailing list