Hi Krasimir,

> insert :: k -> v -> Chart k v -> Maybe (Chart k v)
>
> where the result is (Just _) if the (k,v) is actually added to the
> chart or Nothing if it was already there and nothing have to be done.

insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k
a -> (Maybe a, Map k a)

This should provide the information you need, without the double
traversal of the data structure.

Thanks

Neil
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to