Proposal: Add left, right and strict folds to Data.Set, Data.IntMap and Data.IntSet to mimic Data.Map.

Ian Lynagh igloo at earth.li
Wed Sep 15 11:44:13 EDT 2010


On Tue, Sep 14, 2010 at 06:32:43PM +0200, Milan Straka wrote:
> 
> The naming is a bit tricky. The folds in IntMap mimics Map (ie. foldrWithKey, foldlWithKey, foldlWithKey'; fold and foldWithKey are deprecated in favor of foldrWithKey). The folds in Set and IntSet are classic (foldr, foldl, foldl'; the old fold is deprecated in favor of foldr).

I agree with tibbe on the ticket, that this set of cuntions is
inconsistent, and in fact I've just reverted the inconsistent additions
to Data.Map too.

Perhaps it would be best to wait until the other performance proposals
have been sorted out, and then to add functions consistently across the
whole of containers? It's too late to get into GHC 7.0 anyway, so
there's no rush.


Thanks
Ian



More information about the Libraries mailing list