Skip to content

Commit 50e2490

Browse files
committed
alterCollision: Add pointer equality check
1 parent 5fe4337 commit 50e2490

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Data/HashMap/Internal.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,9 @@ alterCollision f !h !k !ary orig =
13571357
case A.index# ary (otherOfOneOrZero i) of
13581358
(# l #) -> Leaf h l
13591359
| otherwise -> Collision h (A.delete ary i)
1360-
Just v' -> Collision h $ A.update ary i $ L k v'
1360+
Just v'
1361+
| v' `ptrEq` v -> orig
1362+
| otherwise -> Collision h $ A.update ary i $ L k v'
13611363
Nothing -> case f Nothing of
13621364
Nothing -> orig
13631365
Just v' -> Collision h $ A.snoc ary $ L k v'

0 commit comments

Comments
 (0)