X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FIntMap.hs;h=972c2e73fa2217186cb57e551b801e3de4963df9;hb=7659d3c9c7c6dc87d3d2be1391f123c15553a1a4;hp=fd648cb6d9c6863c8cf88899df12967394174deb;hpb=ce95dd798cdf6068515e4e6e08fb8b3f9d65f79a;p=ghc-base.git diff --git a/Data/IntMap.hs b/Data/IntMap.hs index fd648cb..972c2e7 100644 --- a/Data/IntMap.hs +++ b/Data/IntMap.hs @@ -296,11 +296,11 @@ singleton k x {-------------------------------------------------------------------- Insert - 'insert' is the inlined version of 'insertWith (\k x y -> x)' --------------------------------------------------------------------} --- | /O(min(n,W))/. Insert a new key\/value pair in the map. When the key --- is already an element of the set, its value is replaced by the new value, --- ie. 'insert' is left-biased. +-- | /O(min(n,W))/. Insert a new key\/value pair in the map. +-- If the key is already present in the map, the associated value is +-- replaced with the supplied value, i.e. 'insert' is equivalent to +-- @'insertWith' 'const'@. insert :: Key -> a -> IntMap a -> IntMap a insert k x t = case t of @@ -432,7 +432,9 @@ unionsWith :: (a->a->a) -> [IntMap a] -> IntMap a unionsWith f ts = foldlStrict (unionWith f) empty ts --- | /O(n+m)/. The (left-biased) union of two sets. +-- | /O(n+m)/. The (left-biased) union of two maps. +-- It prefers the first map when duplicate keys are encountered, +-- i.e. (@'union' == 'unionWith' 'const'@). union :: IntMap a -> IntMap a -> IntMap a union t1@(Bin p1 m1 l1 r1) t2@(Bin p2 m2 l2 r2) | shorter m1 m2 = union1