Continue to improve map functions
authorDavid Feuer <David.Feuer@gmail.com>
Mon, 1 Aug 2016 21:40:14 +0000 (17:40 -0400)
committerDavid Feuer <David.Feuer@gmail.com>
Wed, 3 Aug 2016 21:16:32 +0000 (17:16 -0400)
commit11cd73c643c4dd1854c18abeea0738862168971c
tree8730e5722d40df8d6b46cd3f32e86302aa4c6a76
parent45bfe23ba21bb43b8c48ca8600c3becf5284cc1c
Continue to improve map functions

Rewrite `unionWith`, `intersectionWithKey`, etc., as independent
functions. Writing either in terms of the other leads to closures
being allocated with extra indirection for the passed function.
`mergeWithKey` misses singleton optimizations for unions. For the
rest, I think `mergeWithKey` is hard to understand, and it's not
immediately obvious how the parts are supposed to fit together.
Since it's used only to reduce *source* code size, and not actual
*generated* code size, I'd rather avoid it for the most part.
I've left `differenceWith` and `differenceWithKey` alone, as they
appear to be rather deeply tied to the concepts in `mergeWithKey`.
Data/Map/Base.hs
Data/Map/Strict.hs
Data/Set/Base.hs
Data/Utils/PtrEquality.hs
tests/map-properties.hs
tests/set-properties.hs