Monadic version of functions for containers (adjustM,
johan.tibell at gmail.com
Tue Sep 28 07:41:34 EDT 2010
On Tue, Sep 28, 2010 at 12:08 AM, Thomas DuBuisson
<thomas.dubuisson at gmail.com> 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
if you want to be consistent.
More information about the Libraries