Skip to content

Commit

Permalink
I don't need that other filter pass
Browse files Browse the repository at this point in the history
The NewGeneration calls do it for me.
  • Loading branch information
dustin committed Aug 24, 2023
1 parent 3a150e0 commit 676b44d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/ExpiringSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ prop_doesMapStuff ops lookups =
massocs = degenerate $ foldl' applyOpM (0, mempty) ops
eassocs = foldl' applyOpE (ExpiringMap.new 0) ops

-- The emulation stores the generation along with the value, so when we're done, we filter out anything old and fmap away the generation.
-- The emulation stores the generation along with the value, so when we're done, we fmap away the generation.
degenerate :: (GenOffset, Map.Map SomeKey (GenOffset, Int)) -> Map.Map SomeKey Int
degenerate (gen, m) = snd <$> Map.filter ((>= gen) . fst) m
degenerate = fmap snd . snd

applyOpM (gen, m) = \case
Insert g k v -> (gen, Map.insert k (gen+g, v) m)
Expand Down

0 comments on commit 676b44d

Please sign in to comment.