Efficent lens operation for Data.Map et al.

roconnor at theorem.ca roconnor at theorem.ca
Wed Jan 18 02:00:30 CET 2012


On Tue, 17 Jan 2012, Johan Tibell wrote:

> On Tue, Jan 17, 2012 at 11:22 AM,  <roconnor at theorem.ca> wrote:
>> In fact, every other Map update operation should be derivable from the lens
>> function.
>
> We tried this an performance was terrible (although we used a zipper.)

Ah, sorry I misread your message the first time around.

Ya, I don't mean to imply that every other operation should be derived 
from the lens function, just that, in principle, they could be.

It would be interesting to compare how fast a lens based implemenation 
would be.  (To be really fast, we probably want to CPS transform the store 
comonad so we don't have to decompose and recompose the resulting pair all 
the time.)

But regardless, I want my fast lens primitive. :)

-- 
Russell O'Connor                                      <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''



More information about the Libraries mailing list