Skip to content

Commit

Permalink
Don't need to reinvent fmap
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Aug 21, 2023
1 parent 2890ece commit 6cc37f6
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Data/Map/Strict/Expiring.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ updateLookupWithKey g f k m@Map{..} = case Map.updateLookupWithKey f' k map of
aging = Map.insert g (Set.singleton k) (removeAging (gen e) k aging)
})
where
f' _ e = case f k (value e) of
Just a -> Just (Entry a g)
Nothing -> Nothing
f' _ e = (`Entry` g) <$> f k (value e)

removeAging :: (Ord g, Ord k) => g -> k -> Map.Map g (Set k) -> Map.Map g (Set k)
removeAging g k = Map.update (nonNull . Set.delete k) g
Expand Down

0 comments on commit 6cc37f6

Please sign in to comment.