File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -826,6 +826,11 @@ unsafeInsert k0 v0 m0 = runST (go h0 k0 v0 0 m0)
826
826
-- | Create a map from two key-value pairs which hashes don't collide. To
827
827
-- enhance sharing, the second key-value pair is represented by the hash of its
828
828
-- key and a singleton HashMap pairing its key with its value.
829
+ --
830
+ -- Note: to avoid silly thunks, this function must be strict in the
831
+ -- key. See issue #232. We don't need to force the HashMap argument
832
+ -- because it's already in WHNF (having just been matched) and we
833
+ -- just put it directly in an array.
829
834
two :: Shift -> Hash -> k -> v -> Hash -> HashMap k v -> ST s (HashMap k v )
830
835
two = go
831
836
where
@@ -836,9 +841,9 @@ two = go
836
841
return $ BitmapIndexed bp1 ary
837
842
| otherwise = do
838
843
mary <- A. new 2 $! Leaf h1 (L k1 v1)
839
- A. write mary idx2 $! t2
844
+ A. write mary idx2 t2
840
845
ary <- A. unsafeFreeze mary
841
- return $! BitmapIndexed (bp1 .|. bp2) ary
846
+ return $ BitmapIndexed (bp1 .|. bp2) ary
842
847
where
843
848
bp1 = mask h1 s
844
849
bp2 = mask h2 s
You can’t perform that action at this time.
0 commit comments