@@ -1748,7 +1748,7 @@ difference :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> HashMap k v
17481748difference a b = foldlWithKey' go empty a
17491749 where
17501750 go m k v = case lookup k b of
1751- Nothing -> insert k v m
1751+ Nothing -> unsafeInsert k v m
17521752 _ -> m
17531753{-# INLINABLE difference #-}
17541754
@@ -1760,8 +1760,8 @@ differenceWith :: (Eq k, Hashable k) => (v -> w -> Maybe v) -> HashMap k v -> Ha
17601760differenceWith f a b = foldlWithKey' go empty a
17611761 where
17621762 go m k v = case lookup k b of
1763- Nothing -> insert k v m
1764- Just w -> maybe m (\ y -> insert k y m) (f v w)
1763+ Nothing -> unsafeInsert k v m
1764+ Just w -> maybe m (\ y -> unsafeInsert k y m) (f v w)
17651765{-# INLINABLE differenceWith #-}
17661766
17671767-- | /O(n*log m)/ Intersection of two maps. Return elements of the first
@@ -1770,7 +1770,7 @@ intersection :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> HashMap k v
17701770intersection a b = foldlWithKey' go empty a
17711771 where
17721772 go m k v = case lookup k b of
1773- Just _ -> insert k v m
1773+ Just _ -> unsafeInsert k v m
17741774 _ -> m
17751775{-# INLINABLE intersection #-}
17761776
@@ -1782,7 +1782,7 @@ intersectionWith :: (Eq k, Hashable k) => (v1 -> v2 -> v3) -> HashMap k v1
17821782intersectionWith f a b = foldlWithKey' go empty a
17831783 where
17841784 go m k v = case lookup k b of
1785- Just w -> insert k (f v w) m
1785+ Just w -> unsafeInsert k (f v w) m
17861786 _ -> m
17871787{-# INLINABLE intersectionWith #-}
17881788
@@ -1794,7 +1794,7 @@ intersectionWithKey :: (Eq k, Hashable k) => (k -> v1 -> v2 -> v3)
17941794intersectionWithKey f a b = foldlWithKey' go empty a
17951795 where
17961796 go m k v = case lookup k b of
1797- Just w -> insert k (f k v w) m
1797+ Just w -> unsafeInsert k (f k v w) m
17981798 _ -> m
17991799{-# INLINABLE intersectionWithKey #-}
18001800
0 commit comments