Skip to content

Commit f1a4d3f

Browse files
committed
Update docs and remove outdated note
Closes #335.
1 parent 324497b commit f1a4d3f

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
@@ -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.
966963
two :: Shift -> Hash -> k -> v -> Hash -> HashMap k v -> ST s (HashMap k v)
967964
two 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.
970972
two' :: Shift -> Hash -> HashMap k v -> Hash -> HashMap k v -> ST s (HashMap k v)
971973
two' s h1 lc1 h2 lc2 = go (shiftHash h1 s) lc1 (shiftHash h2 s) lc2
972974
where

0 commit comments

Comments
 (0)