Proposal: Add // for Data.Sequence

Alan Isaac alan.isaac at gmail.com
Mon May 30 13:21:57 UTC 2016


BACKGROUND
----------

Data.Array provides (//) for incremental array updates.
Data.Sequence lacks this useful functionality.


SCOPE
-----

Doing this efficiently may require that Data.Sequence
access Data.IntMap. (It currently does not.)

David Feuer commented:
We may need to add some more splitting functions to Data.IntMap,
if it supports them, but we probably want to do so anyway to
match up with Data.Map.


SOLUTIONS
-----------

David Feuer offered the following implementation sketch.
(See https://github.com/haskell/containers/issues/262)

Collect all requested changes into an IntMap,
then use something similar to Data.Sequence.splitMap
with Data.IntMap.split to spread them through the tree.

David Feuer commented: splitMap itself is overkill,
because we'll likely be able to preserve whole subtrees.


WHAT MIGHT BREAK
----------------

No anticipated breakage.


More information about the Libraries mailing list