packages feed

monoidal-containers 0.3.0.2 → 0.3.1.0

raw patch · 4 files changed

+30/−11 lines, 4 filesdep +semigroupsdep ~base

Dependencies added: semigroups

Dependency ranges changed: base

Files

monoidal-containers.cabal view
@@ -1,5 +1,5 @@ name:                monoidal-containers-version:             0.3.0.2+version:             0.3.1.0 synopsis:            Containers with monoidal accumulation description:     Containers with merging via monoidal accumulation. The 'Monoid' instances@@ -23,7 +23,7 @@ category:            Data build-type:          Simple cabal-version:       >=1.10-tested-with:         GHC ==7.6.3, GHC ==7.8.4, GHC ==8.0.1+tested-with:         GHC ==7.6.3, GHC ==7.8.4, GHC ==8.0.2, GHC ==8.2.2, GHC ==8.4.1  source-repository head   type:                git@@ -38,12 +38,13 @@                        GeneralizedNewtypeDeriving,                        DeriveTraversable,                        DeriveDataTypeable-  build-depends:       base >=4.5 && <4.11,+  build-depends:       base >=4.5 && <4.12,                        containers >=0.5 && <0.6,                        deepseq >=1.3 && <1.5,                        unordered-containers >= 0.2 && < 0.3,                        hashable >= 1.2 && < 1.3,                        lens >=4.4 && <5,-                       newtype >=0.2 && <0.3+                       newtype >=0.2 && <0.3,+                       semigroups >= 0.18 && < 0.19   hs-source-dirs:      src   default-language:    Haskell2010
src/Data/HashMap/Monoidal.hs view
@@ -38,7 +38,7 @@  import Prelude hiding (lookup, map) import Data.Maybe (fromMaybe)-import Data.Monoid+import Data.Semigroup import Data.Foldable (Foldable) import Control.Applicative (pure) import Data.Data (Data)@@ -92,11 +92,17 @@     _Wrapped' = iso unpack pack     {-# INLINE _Wrapped' #-} +instance (Eq k, Hashable k, Semigroup a) => Semigroup (MonoidalHashMap k a) where+    MonoidalHashMap a <> MonoidalHashMap b = MonoidalHashMap $ M.unionWith (<>) a b+    {-# INLINE (<>) #-}+ instance (Eq k, Hashable k, Monoid a) => Monoid (MonoidalHashMap k a) where     mempty = MonoidalHashMap mempty     {-# INLINE mempty #-}-    MonoidalHashMap a `mappend` MonoidalHashMap b = MonoidalHashMap $ M.unionWith mappend a b+#if !(MIN_VERSION_base(4,11,0))+    mappend (MonoidalHashMap a) (MonoidalHashMap b) = MonoidalHashMap $ M.unionWith mappend a b     {-# INLINE mappend #-}+#endif  instance Newtype (MonoidalHashMap k a) (M.HashMap k a) where     pack = MonoidalHashMap
src/Data/Map/Monoidal.hs view
@@ -28,7 +28,7 @@     , keys     ) where -import Data.Monoid+import Data.Semigroup import Data.Foldable (Foldable) import Data.Traversable (Traversable) import Control.Applicative (Applicative, pure)@@ -89,11 +89,17 @@     _Wrapped' = iso unpack pack     {-# INLINE _Wrapped' #-} +instance (Ord k, Semigroup a) => Semigroup (MonoidalMap k a) where+    MonoidalMap a <> MonoidalMap b = MonoidalMap $ M.unionWith (<>) a b+    {-# INLINE (<>) #-}+ instance (Ord k, Monoid a) => Monoid (MonoidalMap k a) where     mempty = MonoidalMap mempty     {-# INLINE mempty #-}-    MonoidalMap a `mappend` MonoidalMap b = MonoidalMap $ M.unionWith mappend a b+#if !(MIN_VERSION_base(4,11,0))+    mappend (MonoidalMap a) (MonoidalMap b) = MonoidalMap $ M.unionWith mappend a b     {-# INLINE mappend #-}+#endif  instance Newtype (MonoidalMap k a) (M.Map k a) where     pack = MonoidalMap
src/Data/Map/Monoidal/Strict.hs view
@@ -28,7 +28,7 @@     , keys     ) where -import Data.Monoid+import Data.Semigroup import Data.Foldable (Foldable) import Data.Traversable (Traversable) import Control.Applicative (Applicative, pure)@@ -89,11 +89,17 @@     _Wrapped' = iso unpack pack     {-# INLINE _Wrapped' #-} -instance (Ord k, Monoid a) => Monoid (MonoidalMap k a) where+instance (Ord k, Semigroup a) => Semigroup (MonoidalMap k a) where+    MonoidalMap a <> MonoidalMap b = MonoidalMap $ M.unionWith (<>) a b+    {-# INLINE (<>) #-}++instance (Ord k, Semigroup a, Monoid a) => Monoid (MonoidalMap k a) where     mempty = MonoidalMap mempty     {-# INLINE mempty #-}-    MonoidalMap a `mappend` MonoidalMap b = MonoidalMap $ M.unionWith mappend a b+#if !(MIN_VERSION_base(4,11,0))+    mappend (MonoidalMap a) (MonoidalMap b) = MonoidalMap $ M.unionWith mappend a b     {-# INLINE mappend #-}+#endif  instance Newtype (MonoidalMap k a) (M.Map k a) where     pack = MonoidalMap