packages feed

monoid-extras 0.3.2.2 → 0.3.2.3

raw patch · 3 files changed

+25/−11 lines, 3 filesdep ~groupoidsdep ~semigroupoids

Dependency ranges changed: groupoids, semigroupoids

Files

monoid-extras.cabal view
@@ -1,5 +1,5 @@ name:                monoid-extras-version:             0.3.2.2+version:             0.3.2.3 synopsis:            Various extra monoid-related definitions and utilities description:         Various extra monoid-related definitions and utilities,                      such as monoid actions, monoid coproducts, \"deletable\"@@ -33,9 +33,9 @@    build-depends:     base >= 4.3 && < 4.8,                      groups < 0.5,-                     groupoids < 4,+                     groupoids < 5,                      semigroups >= 0.8 && < 0.12,-                     semigroupoids < 4+                     semigroupoids < 5    hs-source-dirs:    src 
src/Data/Monoid/Action.hs view
@@ -1,6 +1,5 @@-{-# LANGUAGE MultiParamTypeClasses-           , FlexibleInstances-  #-}+{-# LANGUAGE FlexibleInstances     #-}+{-# LANGUAGE MultiParamTypeClasses #-}  ----------------------------------------------------------------------------- -- |@@ -17,7 +16,7 @@        ( Action(..)        ) where -import Data.Semigroup+import           Data.Semigroup  ------------------------------------------------------------ --  Monoid and semigroup actions@@ -32,7 +31,7 @@ --   * @act (m1 ``mappend`` m2) = act m1 . act m2@ -- --   Semigroup instances are required to satisfy the second law but with---   '(<>)' instead of 'mappend'.  Additionally, if the type @s@ has+--   ('<>') 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 = --   mempty@ and @act m (s1 ``mappend`` s2) = (act m s1) ``mappend``@@ -60,7 +59,25 @@   act :: m -> s -> s   act = const id +-- | @()@ acts as the identity.+instance Action () l where+  act () = id+ -- | @Nothing@ acts as the identity; @Just m@ acts as @m@. instance Action m s => Action (Option m) s where   act (Option Nothing)  s = s   act (Option (Just m)) s = act m s++-- | @Endo@ acts by application.+--+--   Note that in order for this instance to satisfy the @Action@+--   laws, whenever the type @a@ has some sort of algebraic structure,+--   the type @Endo a@ must be considered to represent /homomorphisms/+--   (structure-preserving maps) on @a@, even though there is no way+--   to enforce this in the type system.  For example, if @a@ is an+--   instance of @Monoid@, then one should only use @Endo a@ values+--   @f@ with the property that @f mempty = mempty@ and @f (a <> b) =+--   f a <> f b@.+instance Action (Endo a) a where+  act = appEndo+
src/Data/Monoid/MList.hs view
@@ -113,9 +113,6 @@ --   heterogeneous monoidal lists on each other. newtype SM m = SM m -instance Action () l where-  act _ a = a- instance (Action (SM a) l2, Action l1 l2) => Action (a, l1) l2 where   act (a,l) = act (SM a) . act l