Skip to content

Commit 490ae89

Browse files
authored
hashWithSalt: Ensure that the salt Int is unboxed (#569)
1 parent 3fa0102 commit 490ae89

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Data/HashMap/Internal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ instance (Hashable k, Hashable v) => Hashable (HashMap k v) where
560560
hashWithSalt salt hm = go salt hm
561561
where
562562
go :: Int -> HashMap k v -> Int
563-
go s Empty = s
563+
go !s Empty = s
564564
go s (BitmapIndexed _ a) = A.foldl' go s a
565565
go s (Leaf h (L _ v))
566566
= s `H.hashWithSalt` h `H.hashWithSalt` v

Data/HashMap/Internal/Array.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,13 @@ unsafeUpdateM ary idx b =
380380
{-# INLINE unsafeUpdateM #-}
381381

382382
foldl' :: (b -> a -> b) -> b -> Array a -> b
383-
foldl' f = \ z0 ary0 -> go ary0 (length ary0) 0 z0
383+
foldl' f = \ z0 ary0 -> foldl'_ ary0 (length ary0) 0 z0
384384
where
385-
go ary n i !z
385+
foldl'_ !ary n i !z
386386
| i >= n = z
387387
| otherwise
388388
= case index# ary i of
389-
(# x #) -> go ary n (i+1) (f z x)
389+
(# x #) -> foldl'_ ary n (i+1) (f z x)
390390
{-# INLINE foldl' #-}
391391

392392
foldr' :: (a -> b -> b) -> b -> Array a -> b

0 commit comments

Comments
 (0)