File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -955,18 +955,20 @@ unsafeInsert k0 v0 m0 = runST (go h0 k0 v0 0 m0)
955955 | otherwise = two s h k x hy t
956956{-# INLINABLE unsafeInsert #-}
957957
958- -- | Create a map from two key-value pairs which hashes don't collide. To
959- -- enhance sharing, the second key-value pair is represented by the hash of its
960- -- key and a singleton HashMap pairing its key with its value.
961- --
962- -- Note: to avoid silly thunks, this function must be strict in the
963- -- key. See issue #232. We don't need to force the HashMap argument
964- -- because it's already in WHNF (having just been matched) and we
965- -- just put it directly in an array.
958+ -- | Create a map from a key-value pair and a 'Leaf' or 'Collision' node with a
959+ -- different hash.
960+ --
961+ -- It is the caller's responsibility to ensure that the HashMap argument is in
962+ -- WHNF.
966963two :: Shift -> Hash -> k -> v -> Hash -> HashMap k v -> ST s (HashMap k v )
967964two s h1 k1 v1 = two' s h1 (Leaf h1 (L k1 v1))
968965{-# INLINE two #-}
969966
967+ -- | Create a map from two 'Leaf' or 'Collision' nodes whose hashes are
968+ -- distinct.
969+ --
970+ -- It is the caller's responsibility to ensure that both HashMap arguments are
971+ -- in WHNF.
970972two' :: Shift -> Hash -> HashMap k v -> Hash -> HashMap k v -> ST s (HashMap k v )
971973two' s h1 lc1 h2 lc2 = go (shiftHash h1 s) lc1 (shiftHash h2 s) lc2
972974 where
You can’t perform that action at this time.
0 commit comments