Proposal: Add // for Data.Sequence

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


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


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.


David Feuer offered the following implementation sketch.

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.


No anticipated breakage.

More information about the Libraries mailing list