Skip to content

Commit 68e24da

Browse files
authored
Make IntMap split, splitLookup strict in the key (#982)
Currently, the key is ignored for an empty map. All IntMap and IntSet functions taking a key are strict in the key. This allows the Int to be unboxed.
1 parent f5d0b13 commit 68e24da

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

containers/changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog for [`containers` package](http://github.com/haskell/containers)
22

3+
## Next release
4+
5+
### Breaking changes
6+
7+
* `Data.IntMap.Lazy.split`, `Data.IntMap.Strict.split`,
8+
`Data.IntMap.Lazy.splitLookup` and `Data.IntMap.Strict.splitLookup` are now
9+
strict in the key. Previously, the key was ignored for an empty map.
10+
(Soumik Sarkar)
11+
312
## 0.7
413

514
### Breaking changes

containers/src/Data/IntMap/Internal.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2815,7 +2815,7 @@ split k t =
28152815
_ -> case go k t of
28162816
(lt :*: gt) -> (lt, gt)
28172817
where
2818-
go k' t'@(Bin p m l r)
2818+
go !k' t'@(Bin p m l r)
28192819
| nomatch k' p m = if k' > p then t' :*: Nil else Nil :*: t'
28202820
| zero k' m = case go k' l of (lt :*: gt) -> lt :*: bin p m gt r
28212821
| otherwise = case go k' r of (lt :*: gt) -> bin p m l lt :*: gt
@@ -2857,7 +2857,7 @@ splitLookup k t =
28572857
_ -> go k t
28582858
of SplitLookup lt fnd gt -> (lt, fnd, gt)
28592859
where
2860-
go k' t'@(Bin p m l r)
2860+
go !k' t'@(Bin p m l r)
28612861
| nomatch k' p m =
28622862
if k' > p
28632863
then SplitLookup t' Nothing Nil

0 commit comments

Comments
 (0)