Skip to content

Commit 5a439cc

Browse files
add haddocks for searchSwap
1 parent 92e4b2a commit 5a439cc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Data/HashMap/Internal.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,15 @@ intersectionCollisions f ary1 ary2 = do
18821882
pure (maryLen, mary)
18831883
{-# INLINE intersectionCollisions #-}
18841884

1885+
-- | Say we have
1886+
-- @
1887+
-- 1 2 3 4
1888+
-- @
1889+
-- and we search for @3@. Then we can mutate the array to
1890+
-- @
1891+
-- undefined 2 1 4
1892+
-- @
1893+
-- We don't actually need to write undefined, we just have to make sure that the next search starts 1 after the current one.
18851894
searchSwap :: Eq k => k -> Int -> A.MArray s (Leaf k v) -> ST s (Maybe (Leaf k v))
18861895
searchSwap toFind start = go start toFind start
18871896
where

0 commit comments

Comments
 (0)