monoid-extras 0.1.1.0 → 0.2.0.0
raw patch · 3 files changed
+17/−9 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 +6/−0
- monoid-extras.cabal +1/−1
- src/Data/Monoid/Action.hs +10/−8
CHANGES view
@@ -1,3 +1,9 @@+* 0.2.0.0++ - Remove instances for actions on pairs and triples, and add some+ commentary explaining why adding them was a bad idea in the first+ place.+ * 0.1.1.0 - Add instances for actions on pairs and triples
monoid-extras.cabal view
@@ -1,5 +1,5 @@ name: monoid-extras-version: 0.1.1.0+version: 0.2.0.0 synopsis: Various extra monoid-related definitions and utilities description: Various extra monoid-related definitions and utilities, such as monoid actions, monoid coproducts, "deletable"
src/Data/Monoid/Action.hs view
@@ -44,6 +44,16 @@ -- > instance Action M s -- -- with no method implementations.+--+-- It is a bit awkward dealing with instances of @Action@, since it+-- is a multi-parameter type class but we can't add any functional+-- dependencies---the relationship between monoids and the types on+-- which they act is truly many-to-many. In practice, this library+-- has chosen to have instance selection for @Action@ driven by the+-- /first/ type parameter. That is, you should never write an+-- instance of the form @Action m SomeType@ since it will overlap+-- with instances of the form @Action SomeMonoid t@. Newtype+-- wrappers can be used to (awkwardly) get around this. class Action m s where -- | Convert a value of type @m@ to an action on @s@ values.@@ -54,11 +64,3 @@ 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)