@@ -812,7 +812,7 @@ insert' h0 k0 v0 m0 = go h0 k0 v0 0 m0
812
812
then t
813
813
else Leaf h (L k x)
814
814
else collision h l (L k x)
815
- | otherwise = runST (two s h k x hy t)
815
+ | otherwise = runST (two s h ( Leaf h ( L k x)) hy t)
816
816
go h k x s t@ (BitmapIndexed b ary)
817
817
| b .&. m == 0 =
818
818
let ! ary' = A. insert ary i $! Leaf h (L k x)
@@ -850,7 +850,7 @@ insertNewKey !h0 !k0 x0 !m0 = go h0 k0 x0 0 m0
850
850
go ! h ! k x ! _ Empty = Leaf h (L k x)
851
851
go h k x s t@ (Leaf hy l)
852
852
| hy == h = collision h l (L k x)
853
- | otherwise = runST (two s h k x hy t)
853
+ | otherwise = runST (two s h ( Leaf h ( L k x)) hy t)
854
854
go h k x s (BitmapIndexed b ary)
855
855
| b .&. m == 0 =
856
856
let ! ary' = A. insert ary i $! Leaf h (L k x)
@@ -935,7 +935,7 @@ unsafeInsert k0 v0 m0 = runST (go h0 k0 v0 0 m0)
935
935
then return t
936
936
else return $! Leaf h (L k x)
937
937
else return $! collision h l (L k x)
938
- | otherwise = two s h k x hy t
938
+ | otherwise = two s h ( Leaf h ( L k x)) hy t
939
939
go h k x s t@ (BitmapIndexed b ary)
940
940
| b .&. m == 0 = do
941
941
ary' <- A. insertM ary i $! Leaf h (L k x)
@@ -958,24 +958,21 @@ unsafeInsert k0 v0 m0 = runST (go h0 k0 v0 0 m0)
958
958
| otherwise = go h k x s $ BitmapIndexed (mask hy s) (A. singleton t)
959
959
{-# INLINABLE unsafeInsert #-}
960
960
961
- -- | Create a map from two key-value pairs which hashes don't collide. To
962
- -- enhance sharing, the second key-value pair is represented by the hash of its
963
- -- key and a singleton HashMap pairing its key with its value.
961
+ -- | Create a map from two key-value pairs which hashes don't collide.
964
962
--
965
- -- Note: to avoid silly thunks, this function must be strict in the
966
- -- key. See issue #232. We don't need to force the HashMap argument
963
+ -- Note: We don't need to force the HashMap argument
967
964
-- because it's already in WHNF (having just been matched) and we
968
965
-- just put it directly in an array.
969
- two :: Shift -> Hash -> k -> v -> Hash -> HashMap k v -> ST s (HashMap k v )
966
+ two :: Shift -> Hash -> HashMap k v -> Hash -> HashMap k v -> ST s (HashMap k v )
970
967
two = go
971
968
where
972
- go s h1 k1 v1 h2 t2
969
+ go s h1 t1 h2 t2
973
970
| bp1 == bp2 = do
974
- st <- go (nextShift s) h1 k1 v1 h2 t2
971
+ st <- go (nextShift s) h1 t1 h2 t2
975
972
ary <- A. singletonM st
976
973
return $ BitmapIndexed bp1 ary
977
974
| otherwise = do
978
- mary <- A. new 2 $! Leaf h1 ( L k1 v1)
975
+ mary <- A. new 2 $! t1
979
976
A. write mary idx2 t2
980
977
ary <- A. unsafeFreeze mary
981
978
return $ BitmapIndexed (bp1 .|. bp2) ary
@@ -1024,7 +1021,7 @@ insertModifying x f k0 m0 = go h0 k0 0 m0
1024
1021
(# v' # ) | ptrEq y v' -> t
1025
1022
| otherwise -> Leaf h (L k v')
1026
1023
else collision h l (L k x)
1027
- | otherwise = runST (two s h k x hy t)
1024
+ | otherwise = runST (two s h ( Leaf h ( L k x)) hy t)
1028
1025
go h k s t@ (BitmapIndexed b ary)
1029
1026
| b .&. m == 0 =
1030
1027
let ary' = A. insert ary i $! Leaf h (L k x)
@@ -1091,7 +1088,7 @@ unsafeInsertWithKey f k0 v0 m0 = runST (go h0 k0 v0 0 m0)
1091
1088
then case f k x y of
1092
1089
(# v # ) -> return $! Leaf h (L k v)
1093
1090
else return $! collision h l (L k x)
1094
- | otherwise = two s h k x hy t
1091
+ | otherwise = two s h ( Leaf h ( L k x)) hy t
1095
1092
go h k x s t@ (BitmapIndexed b ary)
1096
1093
| b .&. m == 0 = do
1097
1094
ary' <- A. insertM ary i $! Leaf h (L k x)
0 commit comments