insertWithKey package:refined-containers

Insert a key-value pair into the map to obtain a potentially larger map, guaranteed to contain the given key. Like insertWith, but the combining function has access to the key, which is guaranteed to be in the old map.
Insert a key-value pair into the map to obtain a potentially larger map, guaranteed to contain the given key. Like insertWith, but the combining function has access to the key, which is guaranteed to be in the old map.
Insert a key-value pair into the map to obtain a potentially larger map, guaranteed to contain the given key. Like insertWith, but the combining function has access to the key, which is guaranteed to be in the old map.