Library proposal: add a Location interface for element-wise operations on Data.Map (#4887)

Heinrich Apfelmus apfelmus at
Tue Jan 11 17:20:35 CET 2011

Ross Paterson wrote:
> This is a variant of a suggestion by apfelmus:
> To avoid proliferation of variants of element-wise operations, the idea
> is to split these operations into two phases mediated by a new Location
> type, so that users can do whatever they like between these phases.
> Documentation is here:
> This adds a type and 9 functions to the interface, but makes possible
> monadic updates and much more.  As an illustration, the file MapOps.hs
> attached to the ticket gives definitions of 30 of the public functions of
> Data.Map in terms of the new interface.

I like it! How could I not? :D

I'm not overly happy with the name "Location", though, because the data 
type not only represents one location but also the whole map around it. 
Maybe "Vicinity" is slightly more apt?

The other names I could think of ("PinnedMap", "FocussedMap", 
"FingerMap", "MarkedMap", "Neighborhood", "TreasureTrove") don't seem to 
be an improvement.

Heinrich Apfelmus


More information about the Libraries mailing list