@@ -832,7 +832,7 @@ insert' h0 k0 v0 m0 = go h0 k0 v0 0 m0
832832 where i = index h s
833833 go h k x s t@ (Collision hy v)
834834 | h == hy = Collision h (updateOrSnocWith (\ a _ -> (# a # )) k x v)
835- | otherwise = go h k x s $ BitmapIndexed (mask hy s) ( A. singleton t)
835+ | otherwise = runST (two s h k x hy t)
836836{-# INLINABLE insert' #-}
837837
838838-- | Insert optimized for the case when we know the key is not in the map.
@@ -866,8 +866,7 @@ insertNewKey !h0 !k0 x0 !m0 = go h0 k0 x0 0 m0
866866 where i = index h s
867867 go h k x s t@ (Collision hy v)
868868 | h == hy = Collision h (A. snoc v (L k x))
869- | otherwise =
870- go h k x s $ BitmapIndexed (mask hy s) (A. singleton t)
869+ | otherwise = runST (two s h k x hy t)
871870{-# NOINLINE insertNewKey #-}
872871
873872
@@ -953,7 +952,7 @@ unsafeInsert k0 v0 m0 = runST (go h0 k0 v0 0 m0)
953952 where i = index h s
954953 go h k x s t@ (Collision hy v)
955954 | h == hy = return $! Collision h (updateOrSnocWith (\ a _ -> (# a # )) k x v)
956- | otherwise = go h k x s $ BitmapIndexed (mask hy s) ( A. singleton t)
955+ | otherwise = two s h k x hy t
957956{-# INLINABLE unsafeInsert #-}
958957
959958-- | Create a map from two key-value pairs which hashes don't collide. To
@@ -1107,7 +1106,7 @@ unsafeInsertWithKey f k0 v0 m0 = runST (go h0 k0 v0 0 m0)
11071106 where i = index h s
11081107 go h k x s t@ (Collision hy v)
11091108 | h == hy = return $! Collision h (updateOrSnocWithKey f k x v)
1110- | otherwise = go h k x s $ BitmapIndexed (mask hy s) ( A. singleton t)
1109+ | otherwise = two s h k x hy t
11111110{-# INLINABLE unsafeInsertWithKey #-}
11121111
11131112-- | \(O(\log n)\) Remove the mapping for the specified key from this map
0 commit comments