@@ -1748,7 +1748,7 @@ difference :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> HashMap k v
1748
1748
difference a b = foldlWithKey' go empty a
1749
1749
where
1750
1750
go m k v = case lookup k b of
1751
- Nothing -> insert k v m
1751
+ Nothing -> unsafeInsert k v m
1752
1752
_ -> m
1753
1753
{-# INLINABLE difference #-}
1754
1754
@@ -1760,8 +1760,8 @@ differenceWith :: (Eq k, Hashable k) => (v -> w -> Maybe v) -> HashMap k v -> Ha
1760
1760
differenceWith f a b = foldlWithKey' go empty a
1761
1761
where
1762
1762
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)
1765
1765
{-# INLINABLE differenceWith #-}
1766
1766
1767
1767
-- | /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
1770
1770
intersection a b = foldlWithKey' go empty a
1771
1771
where
1772
1772
go m k v = case lookup k b of
1773
- Just _ -> insert k v m
1773
+ Just _ -> unsafeInsert k v m
1774
1774
_ -> m
1775
1775
{-# INLINABLE intersection #-}
1776
1776
@@ -1782,7 +1782,7 @@ intersectionWith :: (Eq k, Hashable k) => (v1 -> v2 -> v3) -> HashMap k v1
1782
1782
intersectionWith f a b = foldlWithKey' go empty a
1783
1783
where
1784
1784
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
1786
1786
_ -> m
1787
1787
{-# INLINABLE intersectionWith #-}
1788
1788
@@ -1794,7 +1794,7 @@ intersectionWithKey :: (Eq k, Hashable k) => (k -> v1 -> v2 -> v3)
1794
1794
intersectionWithKey f a b = foldlWithKey' go empty a
1795
1795
where
1796
1796
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
1798
1798
_ -> m
1799
1799
{-# INLINABLE intersectionWithKey #-}
1800
1800
0 commit comments