From a4e8d167c0c0f0001e48f499d33735a61c68d9d4 Mon Sep 17 00:00:00 2001 From: Soumik Sarkar Date: Sun, 14 Jan 2024 06:21:37 +0530 Subject: [PATCH] Make IntSet splitMember strict in the key (#983) Currently, the key is ignored for an empty set. --- containers/changelog.md | 6 +++--- containers/src/Data/IntSet/Internal.hs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/containers/changelog.md b/containers/changelog.md index acf59fa59..41573d669 100644 --- a/containers/changelog.md +++ b/containers/changelog.md @@ -5,9 +5,9 @@ ### Breaking changes * `Data.IntMap.Lazy.split`, `Data.IntMap.Strict.split`, - `Data.IntMap.Lazy.splitLookup` and `Data.IntMap.Strict.splitLookup` are now - strict in the key. Previously, the key was ignored for an empty map. - (Soumik Sarkar) + `Data.IntMap.Lazy.splitLookup`, `Data.IntMap.Strict.splitLookup` and + `Data.IntSet.splitMember` are now strict in the key. Previously, the key was + ignored for an empty map or set. (Soumik Sarkar) ## 0.7 diff --git a/containers/src/Data/IntSet/Internal.hs b/containers/src/Data/IntSet/Internal.hs index a5c0235ca..40bd9bb23 100644 --- a/containers/src/Data/IntSet/Internal.hs +++ b/containers/src/Data/IntSet/Internal.hs @@ -936,7 +936,7 @@ splitMember x t = in (lt, fnd, gt') _ -> go x t where - go x' t'@(Bin p m l r) + go !x' t'@(Bin p m l r) | nomatch x' p m = if x' < p then (Nil, False, t') else (t', False, Nil) | zero x' m = case go x' l of