Skip to content

Commit 0c2ffcf

Browse files
committed
Bangs and INLINE
1 parent 915cc3d commit 0c2ffcf

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Data/HashMap/Internal.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ adjust# f k0 m0 = go h0 k0 0 m0
12621262
-- If it is @('Just' y)@, the key @k@ is bound to the new value @y@.
12631263
update :: (Eq k, Hashable k) => (a -> Maybe a) -> k -> HashMap k a -> HashMap k a
12641264
update f = Exts.inline alter (>>= f)
1265-
{-# INLINABLE update #-}
1265+
{-# INLINE update #-}
12661266

12671267
-- | \(O(\log n)\) The expression @('alter' f k map)@ alters the value @x@ at @k@, or
12681268
-- absence thereof.
@@ -1273,11 +1273,11 @@ update f = Exts.inline alter (>>= f)
12731273
-- 'lookup' k ('alter' f k m) = f ('lookup' k m)
12741274
-- @
12751275
alter :: (Eq k, Hashable k) => (Maybe v -> Maybe v) -> k -> HashMap k v -> HashMap k v
1276-
alter f k = Exts.inline alter' f (hash k) k
1277-
{-# INLINABLE alter #-}
1276+
alter f !k = Exts.inline alter' f (hash k) k
1277+
{-# INLINE alter #-}
12781278

12791279
alter' :: Eq k => (Maybe v -> Maybe v) -> Hash -> k -> HashMap k v -> HashMap k v
1280-
alter' f h0 k0 m0 = go_alter' h0 k0 0 m0
1280+
alter' f !h0 !k0 = go_alter' h0 k0 0
12811281
where
12821282
go_alter' !h !k !_ Empty = case f Nothing of
12831283
Nothing -> Empty

Data/HashMap/Internal/Strict.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ adjust f k0 m0 = go h0 k0 0 m0
300300
-- If it is @('Just' y)@, the key @k@ is bound to the new value @y@.
301301
update :: (Eq k, Hashable k) => (a -> Maybe a) -> k -> HashMap k a -> HashMap k a
302302
update f = Exts.inline alter (>>= f)
303-
{-# INLINABLE update #-}
303+
{-# INLINE update #-}
304304

305305
-- | \(O(\log n)\) The expression @('alter' f k map)@ alters the value @x@ at @k@, or
306306
-- absence thereof.
@@ -314,7 +314,7 @@ alter :: (Eq k, Hashable k) => (Maybe v -> Maybe v) -> k -> HashMap k v -> HashM
314314
alter f = Exts.inline HM.alter $ \m -> case f m of
315315
Nothing -> Nothing
316316
Just !x -> Just x
317-
{-# INLINABLE alter #-}
317+
{-# INLINE alter #-}
318318

319319
-- | \(O(\log n)\) The expression (@'alterF' f k map@) alters the value @x@ at
320320
-- @k@, or absence thereof.

0 commit comments

Comments
 (0)