Skip to content

Commit d35547f

Browse files
committed
Move documentation from lookupCont to Shift
1 parent 868aee0 commit d35547f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Data/HashMap/Internal.hs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,10 @@ type Hash = Word
350350
-- Only the lower 'maxChildren' bits are used. The remaining bits must be zeros.
351351
type Bitmap = Word
352352

353-
-- | 'Shift' values correspond to the level of the tree that we're currently
354-
-- operating at. At the root level the 'Shift' is @0@. For the subsequent
355-
-- levels the 'Shift' values are 'bitsPerSubkey', @2*'bitsPerSubkey'@ etc.
353+
-- | A 'Shift' value is the offset of the subkey in the hash and corresponds
354+
-- to the level of the tree that we're currently operating at. At the root
355+
-- level the 'Shift' is @0@. For the subsequent levels the 'Shift' values are
356+
-- 'bitsPerSubkey', @2*'bitsPerSubkey'@ etc.
356357
--
357358
-- Valid values are non-negative and less than @bitSize (0 :: Word)@.
358359
type Shift = Int
@@ -697,18 +698,14 @@ lookupRecordCollision# h k m =
697698
-- so we can be representation-polymorphic in the result type. Since
698699
-- this whole thing is always inlined, we don't have to worry about
699700
-- any extra CPS overhead.
700-
--
701-
-- The @Int@ argument is the offset of the subkey in the hash. When looking up
702-
-- keys at the top-level of a hashmap, the offset should be 0. When looking up
703-
-- keys at level @n@ of a hashmap, the offset should be @n * bitsPerSubkey@.
704701
lookupCont ::
705702
forall rep (r :: TYPE rep) k v.
706703
Eq k
707704
=> ((# #) -> r) -- Absent continuation
708705
-> (v -> Int -> r) -- Present continuation
709706
-> Hash -- The hash of the key
710707
-> k
711-
-> Shift -- The offset of the subkey in the hash.
708+
-> Shift
712709
-> HashMap k v -> r
713710
lookupCont absent present !h0 !k0 !s0 !m0 = go h0 k0 s0 m0
714711
where

0 commit comments

Comments
 (0)