A single general modification function for Map and IntMap proposal

Johan Tibell johan.tibell at gmail.com
Tue Apr 30 17:32:00 CEST 2013

On Tue, Apr 30, 2013 at 6:18 AM, Nikita Volkov <nikita.y.volkov at gmail.com>wrote:

> Summarizing, my suggestions are:
>    1. Implement an efficient version of "withItem" for lazy and strict
> versions of "Map" and "IntMap".

I think this makes sense as the function makes it possible to more
efficiently express something (that you previously had to express using a
combination of insert and lookup).

   2. Change the order of parameters from "lambda -> key" to "key ->
> lambda". The "updateLookupWithKey" example implementation shows how this
> change can be benefitial.

I'm vary of breaking user code if there isn't a large benefit.

>    3. Begin the deprecation process of the following functions:
> insertWith, insertWithKey, insertLookupWithKey, adjust, adjustWithKey,
> update, updateWithKey, updateLookupWithKey, alter.

We discussed using a function like withItem to implement these functions
before. While we'd really like to, it was shown to be too slow. In other
words, we can't implement these functions in terms of withItem. Also, I
don't see the point of removing them (even after a long deprecation cycle).
It will just break lots of code with little benefit to users.

-- Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130430/3357255f/attachment.htm>

More information about the Libraries mailing list