monoid-extras 0.1.0.0 → 0.1.1.0
raw patch · 3 files changed
+24/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Monoid.Action: instance (Action m a, Action m b) => Action m (a, b)
+ Data.Monoid.Action: instance (Action m a, Action m b, Action m c) => Action m (a, b, c)
Files
- CHANGES +4/−0
- monoid-extras.cabal +11/−5
- src/Data/Monoid/Action.hs +9/−1
CHANGES view
@@ -1,3 +1,7 @@+* 0.1.1.0++ - Add instances for actions on pairs and triples+ * 0.1.0.0 - initial release
monoid-extras.cabal view
@@ -1,21 +1,22 @@ name: monoid-extras-version: 0.1.0.0+version: 0.1.1.0 synopsis: Various extra monoid-related definitions and utilities-description: Various extra monoid-related definitions and utilities, - such as monoid actions, monoid coproducts, "deletable" +description: Various extra monoid-related definitions and utilities,+ such as monoid actions, monoid coproducts, "deletable" monoids, and "split" monoids. license: BSD3 license-file: LICENSE extra-source-files: CHANGES author: Brent Yorgey maintainer: diagrams-discuss@googlegroups.com+bug-reports: https://github.com/diagrams/monoid-extras/issues category: Data build-type: Simple cabal-version: >=1.10 source-repository head- type: git- location: git://github.com/diagrams/monoid-extras.git+ type: git+ location: https://github.com/diagrams/monoid-extras.git library default-language: Haskell2010@@ -31,3 +32,8 @@ semigroups >= 0.8 && < 0.9 hs-source-dirs: src++ other-extensions: DeriveFunctor,+ FlexibleInstances,+ MultiParamTypeClasses,+ TypeOperators
src/Data/Monoid/Action.hs view
@@ -31,7 +31,7 @@ -- -- * @act (m1 ``mappend`` m2) = act m1 . act m2@ ----- Semigroup instances are required to satisfy the same law but with+-- Semigroup instances are required to satisfy the second law but with -- '(<>)' instead of 'mappend'. Additionally, if the type @s@ has -- any algebraic structure, @act m@ should be a homomorphism. For -- example, if @s@ is also a monoid we should have @act m mempty =@@ -54,3 +54,11 @@ instance Action m s => Action (Option m) s where act (Option Nothing) s = s act (Option (Just m)) s = act m s++-- | Actions operate elementwise on pairs.+instance (Action m a, Action m b) => Action m (a,b) where+ act m (a,b) = (act m a, act m b)++-- | Actions operate elementwise on triples.+instance (Action m a, Action m b, Action m c) => Action m (a,b,c) where+ act m (a,b,c) = (act m a, act m b, act m c)