haskell / containers

Assorted concrete container types
https://hackage.haskell.org/package/containers
314 stars 177 forks source link

Make IntMap split, splitLookup strict in the key #982

Closed meooow25 closed 6 months ago

meooow25 commented 6 months ago

All IntMap and IntSet functions taking a key are strict in the key. This allows the Int to be unboxed.

This is technically a breaking change. Currently split undefined empty = (empty, empty), but with this change split undefined empty = undefined.

treeowl commented 6 months ago

Could you add a change log entry please? What were you doing that led you to notice this?

meooow25 commented 6 months ago

Could you add a change log entry please?

Done 👍

What were you doing that led you to notice this?

I have a structure that stores (Int, Int) ranges as IntMap Int, with some operations defined in terms of splitLookup. I checked the core for those operations and noticed that the Ints were boxed, which led me to this.

treeowl commented 6 months ago

Awesome. Thanks!