Quit using deleteFindMin and deleteFindMax
authorDavid Feuer <David.Feuer@gmail.com>
Tue, 6 Sep 2016 23:37:34 +0000 (19:37 -0400)
committerDavid Feuer <David.Feuer@gmail.com>
Wed, 7 Sep 2016 04:52:44 +0000 (00:52 -0400)
commit3f6786b0d7bb90544a266ec792de9a9492d6337c
tree771ecbdfcc9b5366c5336814e3dd8394f3cbe9f9
parent4f70dddee24e800e40318eb271193456d6e444ac
Quit using deleteFindMin and deleteFindMax

Stop using `deleteFindMin` or `deleteFindMax` internally, in both
`Data.Set` and `Data.Map`.

* The `deleteFindMin` and `deleteFindMax` functions are partial,
and also rather ugly. Reimplement `minView`, `minViewWithKey`, `glue`,
etc., using total functions. With manual call-pattern specialization,
this produces pretty core, and slight performance improvements as well.
I'm not sure why GHC doesn't do that specialization for us, but I
couldn't seem to convince it to.

* Add `lookupMin` and `lookupMax`, total versions of `findMin`
and `findMax`, to both `Data.Set` and `Data.Map`. Add `!?`, a
total version of `!`, to `Data.Map`.
Data/Map/Internal.hs
Data/Map/Lazy.hs
Data/Map/Strict.hs
Data/Map/Strict/Internal.hs
Data/Set.hs
Data/Set/Internal.hs
changelog.md
tests/map-properties.hs
tests/set-properties.hs