Skip to content

Commit 4ae9dfa

Browse files
committed
Update docs and remove outdated note
Closes #335.
1 parent 19bf8b6 commit 4ae9dfa

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Data/HashMap/Internal.hs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -956,18 +956,20 @@ unsafeInsert k0 v0 m0 = runST (go h0 k0 v0 0 m0)
956956
| otherwise = go h k x s $ BitmapIndexed (mask hy s) (A.singleton t)
957957
{-# INLINABLE unsafeInsert #-}
958958

959-
-- | Create a map from two key-value pairs which hashes don't collide. To
960-
-- enhance sharing, the second key-value pair is represented by the hash of its
961-
-- key and a singleton HashMap pairing its key with its value.
962-
--
963-
-- Note: to avoid silly thunks, this function must be strict in the
964-
-- key. See issue #232. We don't need to force the HashMap argument
965-
-- because it's already in WHNF (having just been matched) and we
966-
-- just put it directly in an array.
959+
-- | Create a map from a key-value pair and a 'Leaf' or 'Collision' node with a
960+
-- different hash.
961+
--
962+
-- It is the caller's responsibility to ensure that the HashMap argument is in
963+
-- WHNF.
967964
two :: Shift -> Hash -> k -> v -> Hash -> HashMap k v -> ST s (HashMap k v)
968965
two s h1 k1 v1 = two' s h1 (Leaf h1 (L k1 v1))
969966
{-# INLINE two #-}
970967

968+
-- | Create a map from two 'Leaf' or 'Collision' nodes whose hashes are
969+
-- distinct.
970+
--
971+
-- It is the caller's responsibility to ensure that both HashMap arguments are
972+
-- in WHNF.
971973
two' :: Shift -> Hash -> HashMap k v -> Hash -> HashMap k v -> ST s (HashMap k v)
972974
two' s h1 lc1 h2 lc2 = go (shiftHash h1 s) lc1 (shiftHash h2 s) lc2
973975
where

0 commit comments

Comments
 (0)