Skip to content

Commit 5723db9

Browse files
authored
Fix strictness of Map.Strict.mergeWithKey (#1024)
Force the result of the combining function.
1 parent 96a8dec commit 5723db9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

containers/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
`Data.IntSet.splitMember` are now strict in the key. Previously, the key was
1010
ignored for an empty map or set. (Soumik Sarkar)
1111

12+
### Bug fixes
13+
14+
* `Data.Map.Strict.mergeWithKey` now forces the result of the combining function
15+
to WHNF. (Soumik Sarkar)
16+
1217
## Unreleased with `@since` annotation for 0.7.1:
1318

1419
### Additions

containers/src/Data/Map/Strict/Internal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ mergeWithKey f g1 g2 = go
12501250
_ -> error "mergeWithKey: Given function only1 does not fulfill required conditions (see documentation)"
12511251
Just x2 -> case f kx x x2 of
12521252
Nothing -> link2 l' r'
1253-
Just x' -> link kx x' l' r'
1253+
Just !x' -> link kx x' l' r'
12541254
where
12551255
(l2, found, r2) = splitLookup kx t2
12561256
l' = go l1 l2

0 commit comments

Comments
 (0)