
On Tue, Sep 28, 2010 at 12:08 AM, Thomas DuBuisson
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. foldl foldlWithKey foldlM foldlWithKeyM foldl' foldlWithKey' foldlM' foldlWithKeyM' if you want to be consistent. -- Johan