diff --git a/CHANGES.md b/CHANGES.md index 3f4f1764..61418c40 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,25 @@ +## [0.2.12.0] + +* Add `HashMap.isSubmapOf[By]` and `HashSet.isSubsetOf`. Thanks Sven Keidel. ([#282]) + +* Expose internal modules. ([#283]) + +* Documentation improvements in `Data.HashSet`, including a beginner-friendly + introduction. Thanks Matt Renaud. ([#267]) + +* `HashMap.alterF`: Skip key deletion for absent keys. ([#288]) + +* Remove custom `unsafeShift{L,R}` definitions. ([#281]) + +* Various other documentation improvements. + +[0.2.12.0]: https://github.com/haskell-unordered-containers/unordered-containers/compare/v0.2.11.0...v0.2.12.0 +[#267]: https://github.com/haskell-unordered-containers/unordered-containers/pull/267 +[#281]: https://github.com/haskell-unordered-containers/unordered-containers/pull/281 +[#282]: https://github.com/haskell-unordered-containers/unordered-containers/pull/282 +[#283]: https://github.com/haskell-unordered-containers/unordered-containers/pull/283 +[#288]: https://github.com/haskell-unordered-containers/unordered-containers/pull/288 + ## 0.2.11.0 * Add `HashMap.findWithDefault` (soft-deprecates `HashMap.lookupDefault`). diff --git a/Data/HashMap/Internal.hs b/Data/HashMap/Internal.hs index 30ad0e01..1f75d6a7 100644 --- a/Data/HashMap/Internal.hs +++ b/Data/HashMap/Internal.hs @@ -1431,6 +1431,8 @@ alterFEager f !k m = (<$> f mv) $ \fres -> -- -- >>> fromList [(1,'a'),(2,'b')] `isSubmapOf` fromList [(1,'a')] -- False +-- +-- @since 0.2.12 isSubmapOf :: (Eq k, Hashable k, Eq v) => HashMap k v -> HashMap k v -> Bool isSubmapOf = (inline isSubmapOfBy) (==) {-# INLINABLE isSubmapOf #-} @@ -1449,6 +1451,8 @@ isSubmapOf = (inline isSubmapOfBy) (==) -- -- >>> isSubmapOfBy (<=) (fromList [(1,'b')]) (fromList [(1,'a'),(2,'c')]) -- False +-- +-- @since 0.2.12 isSubmapOfBy :: (Eq k, Hashable k) => (v1 -> v2 -> Bool) -> HashMap k v1 -> HashMap k v2 -> Bool -- For maps without collisions the complexity is O(n*log m), where n is the size -- of m1 and m the size of m2: the inclusion operation visits every leaf in m1 at least once. diff --git a/Data/HashSet/Internal.hs b/Data/HashSet/Internal.hs index 1fdc091c..68ed078a 100644 --- a/Data/HashSet/Internal.hs +++ b/Data/HashSet/Internal.hs @@ -321,6 +321,8 @@ keysSet m = fromMap (() <$ m) -- -- >>> fromList [1,2] `isSubsetOf` fromList [1,3] -- False +-- +-- @since 0.2.12 isSubsetOf :: (Eq a, Hashable a) => HashSet a -> HashSet a -> Bool isSubsetOf s1 s2 = H.isSubmapOfBy (\_ _ -> True) (asMap s1) (asMap s2) diff --git a/unordered-containers.cabal b/unordered-containers.cabal index e81d8b41..e5df5eee 100644 --- a/unordered-containers.cabal +++ b/unordered-containers.cabal @@ -1,5 +1,5 @@ name: unordered-containers -version: 0.2.11.0 +version: 0.2.12.0 synopsis: Efficient hashing-based container types description: Efficient hashing-based container types. The containers have been