Proposal: keep Data.Map.foldWithKey

Johan Tibell johan.tibell at
Wed Dec 15 15:38:37 CET 2010

Hi all,

On Tue, Dec 14, 2010 at 1:28 PM, Christian Maeder
<Christian.Maeder at> wrote:
> I've now created a proper library proposal to keep Data.Map.foldWithKey.
> Exchange arguments and make up your mind until Jan. 15th.

My vote is "no", there are already too many fold variants in Data.Map. We have

{left,right} x {non-strict,strict} x {with key, without key} = 8
combinations together.

Adding back the "directionless" version would mean another 4 versions
of we want symmetry. This in a module that already has 150 functions.

We need to do something about the large amount of both API (i.e.
usability tax) and implementation (maintainer overhead) duplication in
the containers library. Throwing out functions that don't add much to
expressibility* only gets us so far, but I think it's a step in the
right direction.

* I appreciate that being able to use a "directionless" fold lets the
author communicate his intent slightly better, but I think it's
outweighed by the API growth and code duplication.


More information about the Libraries mailing list