mini 1.4.0.2 → 1.4.1.0
raw patch · 4 files changed
+26/−3 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Mini.Data.Set: instance GHC.Classes.Ord a => GHC.Base.Monoid (Mini.Data.Set.Set a)
+ Mini.Data.Set: instance GHC.Classes.Ord a => GHC.Base.Semigroup (Mini.Data.Set.Set a)
Files
- CHANGELOG.md +4/−0
- Mini/Data/Map.hs +6/−1
- Mini/Data/Set.hs +15/−1
- mini.cabal +1/−1
CHANGELOG.md view
@@ -1,3 +1,7 @@+1.4.1.0 [2024-11-01]+--------------------+* Mini.Data.Set: Add Semigroup/Monoid instances+ 1.4.0.2 [2024-10-29] -------------------- * Mini.Data.Map:
Mini/Data/Map.hs view
@@ -120,7 +120,12 @@ B (Map k a) k a (Map k a) | -- | Right-heavy bin R (Map k a) k a (Map k a)- deriving (Eq, Ord)++instance (Eq k, Eq a) => Eq (Map k a) where+ t1 == t2 = toAscList t1 == toAscList t2++instance (Ord k, Ord a) => Ord (Map k a) where+ compare t1 t2 = compare (toAscList t1) (toAscList t2) instance (Show k, Show a) => Show (Map k a) where show = curl . map [] go go go
Mini/Data/Set.hs view
@@ -55,12 +55,14 @@ Just, Nothing ),+ Monoid, Ord, Ordering ( EQ, GT, LT ),+ Semigroup, Show, compare, error,@@ -68,6 +70,7 @@ foldl, foldr, max,+ mempty, show, uncurry, ($),@@ -95,8 +98,13 @@ B (Set a) a (Set a) | -- | Right-heavy node R (Set a) a (Set a)- deriving (Eq, Ord) +instance (Eq a) => Eq (Set a) where+ t1 == t2 = toAscList t1 == toAscList t2++instance (Ord a) => Ord (Set a) where+ compare t1 t2 = compare (toAscList t1) (toAscList t2)+ instance (Show a) => Show (Set a) where show = curl . set [] go go go where@@ -111,6 +119,12 @@ foldr f b = set b go go go where go _ a r recl _ = foldr f (f a recl) r++instance (Ord a) => Semigroup (Set a) where+ (<>) = union++instance (Ord a) => Monoid (Set a) where+ mempty = empty {- - Primitive recursion
mini.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: mini-version: 1.4.0.2+version: 1.4.1.0 license: MIT license-file: LICENSE author: Victor Wallsten <victor.wallsten@protonmail.com>