Closed claudio-etterli closed 3 weeks ago
I had a look at Haskell's Data.Map today, and I am in strong favour of adding the utilities from this PR (including insertWith
). The Haskell module has a function like Data.SortedMap.update
(it's called alter
there) as well as insertWith
, fromListWith
, and several other related utilities.
In my own code, the need for insertWith
comes up quite frequently, while I hardly ever used update
so far, probably because it is much more comon to add something to a SortedMap
than to delete stuff.
Description
Added
insertWith
,insertFromWith
andfromListWith
to the SortedMap module. The idea is to insert key-value pairs and decide how duplicated values should be merged. Unique key-values pairs will be appended to the SortedMap.Should this change go in the CHANGELOG?
CHANGELOG_NEXT.md
(and potentially alsoCONTRIBUTORS.md
).