diff --git a/CHANGES.md b/CHANGES.md index e039b2a6..b84af01c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,11 +1,30 @@ -## next +## 0.2.11.0 + + * Add `HashMap.findWithDefault` (soft-deprecates `HashMap.lookupDefault`). + + * Add `HashMap.fromListWithKey` - * Add `HashMap.findWithDefault` (deprecates `HashMap.lookupDefault`) - * Add more folding functions and use them in `Foldable` instances. * Add `HashMap.!?`, a flipped version of `lookup`. + * Add `instance Bifoldable HashMap`. + +### Bug fixes + + * Fix a space leak affecting updates on keys with hash collisions. + + * Improvements for `two`: strictness in key arguments, better sharing, + clean up. + +### Other changes + + * Add call stack to `HashMap.!`. + + * Speed up the `Hashable` instances for `HashMap` and `HashSet`. + + * Various documentation improvements and fixes. + ## 0.2.10.0 * Add `HashMap.alterF`. diff --git a/Data/HashMap/Base.hs b/Data/HashMap/Base.hs index 2f8805f0..310b9229 100644 --- a/Data/HashMap/Base.hs +++ b/Data/HashMap/Base.hs @@ -227,7 +227,7 @@ instance Foldable.Foldable (HashMap k) where #endif #if MIN_VERSION_base(4,10,0) --- | @since UNRELEASED +-- | @since 0.2.11 instance Bifoldable HashMap where bifoldMap f g = foldMapWithKey (\ k v -> f k `mappend` g v) {-# INLINE bifoldMap #-} @@ -1251,7 +1251,7 @@ alter f k m = -- Note: 'alterF' is a flipped version of the 'at' combinator from -- . -- --- @since 0.2.9 +-- @since 0.2.10 alterF :: (Functor f, Eq k, Hashable k) => (Maybe v -> f (Maybe v)) -> k -> HashMap k v -> f (HashMap k v) -- We only calculate the hash once, but unless this is rewritten @@ -1945,6 +1945,8 @@ fromListWith f = L.foldl' (\ m (k, v) -> unsafeInsertWith f k v m) empty -- -- > fromListWith f [(k, a), (k, b), (k, c), (k, d)] -- > = fromList [(k, f k d (f k c (f k b a)))] +-- +-- @since 0.2.11 fromListWithKey :: (Eq k, Hashable k) => (k -> v -> v -> v) -> [(k, v)] -> HashMap k v fromListWithKey f = L.foldl' (\ m (k, v) -> unsafeInsertWithKey f k v m) empty {-# INLINE fromListWithKey #-} diff --git a/Data/HashMap/Strict/Base.hs b/Data/HashMap/Strict/Base.hs index 0bd7f13a..6cdb221d 100644 --- a/Data/HashMap/Strict/Base.hs +++ b/Data/HashMap/Strict/Base.hs @@ -282,7 +282,7 @@ alter f k m = -- Note: 'alterF' is a flipped version of the 'at' combinator from -- . -- --- @since 0.2.9 +-- @since 0.2.10 alterF :: (Functor f, Eq k, Hashable k) => (Maybe v -> f (Maybe v)) -> k -> HashMap k v -> f (HashMap k v) -- Special care is taken to only calculate the hash once. When we rewrite @@ -670,6 +670,8 @@ fromListWith f = L.foldl' (\ m (k, v) -> unsafeInsertWith f k v m) empty -- -- > fromListWith f [(k, a), (k, b), (k, c), (k, d)] -- > = fromList [(k, f k d (f k c (f k b a)))] +-- +-- @since 0.2.11 fromListWithKey :: (Eq k, Hashable k) => (k -> v -> v -> v) -> [(k, v)] -> HashMap k v fromListWithKey f = L.foldl' (\ m (k, v) -> unsafeInsertWithKey f k v m) empty {-# INLINE fromListWithKey #-} diff --git a/unordered-containers.cabal b/unordered-containers.cabal index 873b22c2..cdaa0825 100644 --- a/unordered-containers.cabal +++ b/unordered-containers.cabal @@ -1,5 +1,5 @@ name: unordered-containers -version: 0.2.10.0 +version: 0.2.11.0 synopsis: Efficient hashing-based container types description: Efficient hashing-based container types. The containers have been