Skip to content

Commit

Permalink
Inline alterF and alter
Browse files Browse the repository at this point in the history
  • Loading branch information
utdemir committed Jul 22, 2021
1 parent 1e50814 commit f639d6f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Data/HashMap/Mutable/Linear/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ alterF f key hm =
((ix + 1) `mod` cap)
(incRobinValPSL evicted)
& growMapIfNecessary
{-# INLINE alterF #-}

-- aspiwack: I'm implementing `alter` in terms of `alterF`, because, at this
-- point, we may have some bug fixes and so on and so forth. And maintaining two
Expand All @@ -217,6 +218,7 @@ alter f key hm = runIdentity $ alterF (\v -> Identity (Ur (f v))) key hm
where
runIdentity :: Identity a %1-> a
runIdentity (Identity x) = x
{-# INLINE alter #-}

-- | Insert a key value pair to a 'HashMap'. It overwrites the previous
-- value if it exists.
Expand Down

0 comments on commit f639d6f

Please sign in to comment.