WeakSets 1.1.3.0 → 1.1.4.0
raw patch · 3 files changed
+11/−4 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.WeakMap: insert :: Eq k => k -> a -> Map k a -> Map k a
+ Data.WeakMap: insert :: k -> a -> Map k a -> Map k a
Files
- CHANGELOG.md +5/−1
- WeakSets.cabal +1/−1
- src/Data/WeakMap.hs +5/−2
CHANGELOG.md view
@@ -22,4 +22,8 @@ # 1.1.3.0 -- 2022-07-20 -* Addition of inverse and pseudoInverse functions.+* Addition of inverse and pseudoInverse functions. + +# 1.1.4.0 -- 2022-07-20 + +* Major bug correction : instance Eq for Data.WeakMap
WeakSets.cabal view
@@ -14,7 +14,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 1.1.3.0 +version: 1.1.4.0 -- A short (one-line) description of the package. synopsis:
src/Data/WeakMap.hs view
@@ -225,8 +225,11 @@ -- | A weak map is a weak set of pairs (key,value) such that their should only be one pair with a given key. -- -- It is an abstract type, the smart constructor is `weakMap`. -data Map k v = Map {-# UNPACK #-} !(Set (k,v)) deriving (Eq) +data Map k v = Map {-# UNPACK #-} !(Set (k,v)) +instance (Eq k, Eq v) => Eq (Map k v) where + m1 == m2 = (mapToSet m1) == (mapToSet m2) + instance (Show k, Show v) => Show (Map k v) where show (Map al) = "(weakMap "++ init rest ++")" where @@ -395,7 +398,7 @@ -- | /O(1)/. Insert a new key and value in the map. If the key is already present in the map, the associated value is replaced with the supplied value. `insert` is equivalent to @`insertWith` `const`@. -insert :: (Eq k) => k -> a -> Map k a -> Map k a +insert :: k -> a -> Map k a -> Map k a insert k v (Map al) = Map $ Set.insert (k,v) al -- | /O(n)/. Insert with a function, combining new value and old value. @insertWith f key value mp@ will insert the pair (key, value) into mp if key does not exist in the function. If the key does exist, the function will insert the pair (key, f new_value old_value).