Add `alterF` for Data.Map
authorDavid Feuer <David.Feuer@gmail.com>
Mon, 2 May 2016 18:29:36 +0000 (14:29 -0400)
committerDavid Feuer <David.Feuer@gmail.com>
Wed, 18 May 2016 22:48:56 +0000 (18:48 -0400)
commit7d03d76b7647dc731da2e75dcdd45f6c2e667682
treea1ea6ed71cf2a669acf6ae8932b8f1aec1e5d8c1
parent73ba96ade09b2e1720d529566c7bf834cd54853c
Add `alterF` for Data.Map

Use a bit queue to implement `alterF` for `Data.Map`. This is fairly
competitive with the simple implementation in `Control.Lens.At`
even with `Int` keys. For keys that are more expensive to compare,
it should be substantially better. In case of extremely large maps
that would overflow the bit queue, this falls back to a slower,
Yoneda-based, implementation. This code is disabled when the word
size is at least 61, as maps with nearly a quadrillion entries seem
somewhat unlikely.

Add rules to specialize to `Const` and `Identity` functors.

Add QuickCheck properties to supplement the unit tests, including
ones that should trigger the rewrite rules and ones that should not.

Remove some more pre-7.0 junk.
12 files changed:
.gitignore
Data/Map/Base.hs
Data/Map/Lazy.hs
Data/Map/Strict.hs
Data/Sequence.hs
Data/Utils/BitQueue.hs [new file with mode: 0644]
Data/Utils/BitUtil.hs
benchmarks/Map.hs
changelog.md
containers.cabal
tests/bitqueue-properties.hs [new file with mode: 0644]
tests/map-properties.hs