Monadic version of functions for containers (adjustM, updateWithKeyM, etc)

Johan Tibell johan.tibell at
Tue Sep 28 07:41:34 EDT 2010

On Tue, Sep 28, 2010 at 12:08 AM, Thomas DuBuisson
<thomas.dubuisson at> wrote:
> If the number of functions becomes a concern we can be effective and
> still conservative.  Take Data.Map as an example, we can make
> updateLookupWithKeyM and omit alterM, alterWithKeyM,
> insertLookupWithKeyM, etc as those can be built using
> updateLookupWithKeyM - no power lost.  This strategy might cut the
> number of functions down from ~2 dozen to a bare handful ( I expect a
> 'map' variant will be sensible, probably one or two others).

That sounds sensible. It would be great if someone could write a
benchmark to check if the more general function has the same
performance as the more specialized ones.

It's really unfortunate that we have with and without key versions of
everything. It forces you to have 8 (!) copies of higher order
functions e.g.


if you want to be consistent.

-- Johan

More information about the Libraries mailing list