
9 Dec
2008
9 Dec
'08
3:11 a.m.
Hi, I'm looking for a function for Data.Map that will insert a new key and value into the map if the key doesn't already exist in the map. When the key already exists, I don't want the value updated in the map. Additionally, I want to know whether the key/value was inserted or not so that I can return that fact as a boolean from my function. I can't work out which function in Data.Map is suitable for this task and I wanted to avoid two lookups. Thanks, -John