free-algebras-0.0.6.0: Free algebras in Haskell.

Data.Monoid.MSet

Description

Monoid and group actions (M-Sets and G-Sets). The category of MSets (and GSets) is monadic (unlike the category of SSets).

Synopsis

# Documentation

class (Monoid m, SSet m a) => MSet m a where Source #

Lawful instance should satisfy:

act mempty = id
g act h act a = g <> h act a

This is the same as to say that act is a monoid homomorphism from m to the monoid of endomorphisms of a (i.e. maps from a to a).

Note that if g is a Group then an MSet is simply a GSet, this is because monoids and groups share the same morphisms (a monoid homomorphis between groups necessarily preserves inverses).

Minimal complete definition

Nothing

Methods

mact :: m -> a -> a Source #

Instances
 Monoid m => MSet m m Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> m -> m Source # MSet m a => MSet m (IO a) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> IO a -> IO a Source # MSet m a => MSet m (Down a) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> Down a -> Down a Source # MSet m a => MSet m (Maybe a) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> Maybe a -> Maybe a Source # MSet m a => MSet m (Identity a) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> Identity a -> Identity a Source # (MSet m a, Ord a) => MSet m (Set a) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> Set a -> Set a Source # MSet m a => MSet m (NonEmpty a) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> NonEmpty a -> NonEmpty a Source # MSet m a => MSet m [a] Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> [a] -> [a] Source # Monoid m => MSet m (FreeMSet m a) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> FreeMSet m a -> FreeMSet m a Source # MSet m b => MSet m (a -> b) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> (a -> b) -> a -> b Source # MSet m b => MSet m (Either a b) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> Either a b -> Either a b Source # (MSet m a, MSet m b) => MSet m (a, b) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> (a, b) -> (a, b) Source # MSet m a => MSet m (Const a b) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> Const a b -> Const a b Source # (MSet m a, MSet m b, MSet m c) => MSet m (a, b, c) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> (a, b, c) -> (a, b, c) Source # (Functor f, Functor h, MSet m a) => MSet m (Sum f h a) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> Sum f h a -> Sum f h a Source # (Functor f, Functor h, MSet m a) => MSet m (Product f h a) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> Product f h a -> Product f h a Source # (MSet m a, MSet m b, MSet m c, MSet m d) => MSet m (a, b, c, d) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> (a, b, c, d) -> (a, b, c, d) Source # (MSet m a, MSet m b, MSet m c, MSet m d, MSet m e) => MSet m (a, b, c, d, e) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> (a, b, c, d, e) -> (a, b, c, d, e) Source # (MSet m a, MSet m b, MSet m c, MSet m d, MSet m e, MSet m f) => MSet m (a, b, c, d, e, f) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source # (MSet m a, MSet m b, MSet m c, MSet m d, MSet m e, MSet m f, MSet m h) => MSet m (a, b, c, d, e, f, h) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> (a, b, c, d, e, f, h) -> (a, b, c, d, e, f, h) Source # (MSet m a, MSet m b, MSet m c, MSet m d, MSet m e, MSet m f, MSet m h, MSet m i) => MSet m (a, b, c, d, e, f, h, i) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> (a, b, c, d, e, f, h, i) -> (a, b, c, d, e, f, h, i) Source # MSet m a => MSet (Identity m) a Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: Identity m -> a -> a Source # MSet (Endo a) a Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: Endo a -> a -> a Source # Num s => MSet (Sum s) s Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: Sum s -> s -> s Source # Monoid m => MSet (Sum Natural) m Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: Sum Natural -> m -> m Source # Num s => MSet (Product s) s Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: Product s -> s -> s Source # MSet m b => MSet (S m) (Endo b) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: S m -> Endo b -> Endo b Source #

class Semigroup s => SSet s a where Source #

A lawful instance should satisfy:

g act h act a = g <> h act a

This is the same as to say that act is a semigroup homomorphism from s to the monoid of endomorphisms of a (i.e. maps from a to a).

Note that if g is a Group then MAct g is simply a GSet, this is because monoids and groups share the same morphisms (a monoid homomorphis between groups necessarily preserves inverses).

Methods

act :: s -> a -> a Source #

Instances
 Semigroup s => SSet s s Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> s -> s Source # SSet s a => SSet s (IO a) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> IO a -> IO a Source # SSet s a => SSet s (Down a) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> Down a -> Down a Source # SSet s a => SSet s (Maybe a) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> Maybe a -> Maybe a Source # SSet s a => SSet s (Identity a) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> Identity a -> Identity a Source # (SSet s a, Ord a) => SSet s (Set a) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> Set a -> Set a Source # SSet s a => SSet s (NonEmpty a) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> NonEmpty a -> NonEmpty a Source # SSet s a => SSet s [a] Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> [a] -> [a] Source # SSet s b => SSet s (a -> b) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> (a -> b) -> a -> b Source # SSet s b => SSet s (Either a b) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> Either a b -> Either a b Source # (SSet s a, SSet s b) => SSet s (a, b) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> (a, b) -> (a, b) Source # Semigroup m => SSet m (FreeMSet m a) Source # Instance detailsDefined in Data.Monoid.MSet Methodsact :: m -> FreeMSet m a -> FreeMSet m a Source # SSet s a => SSet s (Const a b) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> Const a b -> Const a b Source # (SSet s a, SSet s b, SSet s c) => SSet s (a, b, c) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> (a, b, c) -> (a, b, c) Source # (Functor f, Functor h, SSet s a) => SSet s (Sum f h a) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> Sum f h a -> Sum f h a Source # (Functor f, Functor h, SSet s a) => SSet s (Product f h a) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> Product f h a -> Product f h a Source # (SSet s a, SSet s b, SSet s c, SSet s d) => SSet s (a, b, c, d) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> (a, b, c, d) -> (a, b, c, d) Source # (SSet s a, SSet s b, SSet s c, SSet s d, SSet s e) => SSet s (a, b, c, d, e) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> (a, b, c, d, e) -> (a, b, c, d, e) Source # (SSet s a, SSet s b, SSet s c, SSet s d, SSet s e, SSet s f) => SSet s (a, b, c, d, e, f) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source # (SSet s a, SSet s b, SSet s c, SSet s d, SSet s e, SSet s f, SSet s h) => SSet s (a, b, c, d, e, f, h) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> (a, b, c, d, e, f, h) -> (a, b, c, d, e, f, h) Source # (SSet s a, SSet s b, SSet s c, SSet s d, SSet s e, SSet s f, SSet s h, SSet s i) => SSet s (a, b, c, d, e, f, h, i) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: s -> (a, b, c, d, e, f, h, i) -> (a, b, c, d, e, f, h, i) Source # SSet s a => SSet (Identity s) a Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: Identity s -> a -> a Source # SSet (Endo a) a Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: Endo a -> a -> a Source # Group g => SSet (Sum Integer) g Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: Sum Integer -> g -> g Source # Num s => SSet (Sum s) s Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: Sum s -> s -> s Source # Monoid s => SSet (Sum Natural) s Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: Sum Natural -> s -> s Source # Num s => SSet (Product s) s Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: Product s -> s -> s Source # SSet s a => SSet (S s) (Endo a) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: S s -> Endo a -> Endo a Source #

newtype Endo a #

The monoid of endomorphisms under composition.

>>> let computation = Endo ("Hello, " ++) <> Endo (++ "!")
>>> appEndo computation "Haskell"
"Hello, Haskell!"


Constructors

 Endo FieldsappEndo :: a -> a
Instances
 Generic (Endo a) Instance detailsDefined in Data.Semigroup.Internal Associated Typestype Rep (Endo a) :: Type -> Type # Methodsfrom :: Endo a -> Rep (Endo a) x #to :: Rep (Endo a) x -> Endo a # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup.Internal Methods(<>) :: Endo a -> Endo a -> Endo a #sconcat :: NonEmpty (Endo a) -> Endo a #stimes :: Integral b => b -> Endo a -> Endo a # Monoid (Endo a) Since: base-2.1 Instance detailsDefined in Data.Semigroup.Internal Methodsmempty :: Endo a #mappend :: Endo a -> Endo a -> Endo a #mconcat :: [Endo a] -> Endo a # SSet (Endo a) a Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: Endo a -> a -> a Source # MSet (Endo a) a Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: Endo a -> a -> a Source # SSet s a => SSet (S s) (Endo a) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: S s -> Endo a -> Endo a Source # MSet m b => MSet (S m) (Endo b) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: S m -> Endo b -> Endo b Source # type Rep (Endo a) Since: base-4.7.0.0 Instance detailsDefined in Data.Semigroup.Internal type Rep (Endo a) = D1 (MetaData "Endo" "Data.Semigroup.Internal" "base" True) (C1 (MetaCons "Endo" PrefixI True) (S1 (MetaSel (Just "appEndo") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (a -> a))))

rep :: SSet s a => s -> Endo a Source #

fact :: (Functor f, SSet s a) => s -> f a -> f a Source #

Any SSet wrapped in a functor is a valid SSet.

newtype FreeMSet m a Source #

Constructors

 FreeMSet FieldsrunFreeMSet :: (m, a)
Instances
 Semigroup m => SSet m (FreeMSet m a) Source # Instance detailsDefined in Data.Monoid.MSet Methodsact :: m -> FreeMSet m a -> FreeMSet m a Source # Monoid m => MSet m (FreeMSet m a) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: m -> FreeMSet m a -> FreeMSet m a Source # Monoid m => Monad (FreeMSet m) Source # Instance detailsDefined in Data.Monoid.MSet Methods(>>=) :: FreeMSet m a -> (a -> FreeMSet m b) -> FreeMSet m b #(>>) :: FreeMSet m a -> FreeMSet m b -> FreeMSet m b #return :: a -> FreeMSet m a #fail :: String -> FreeMSet m a # Source # Instance detailsDefined in Data.Monoid.MSet Methodsfmap :: (a -> b) -> FreeMSet m a -> FreeMSet m b #(<\$) :: a -> FreeMSet m b -> FreeMSet m a # Monoid m => Applicative (FreeMSet m) Source # Instance detailsDefined in Data.Monoid.MSet Methodspure :: a -> FreeMSet m a #(<*>) :: FreeMSet m (a -> b) -> FreeMSet m a -> FreeMSet m b #liftA2 :: (a -> b -> c) -> FreeMSet m a -> FreeMSet m b -> FreeMSet m c #(*>) :: FreeMSet m a -> FreeMSet m b -> FreeMSet m b #(<*) :: FreeMSet m a -> FreeMSet m b -> FreeMSet m a # Monoid m => FreeAlgebra (FreeMSet m) Source # Instance detailsDefined in Data.Monoid.MSet MethodsreturnFree :: a -> FreeMSet m a Source #foldMapFree :: (AlgebraType (FreeMSet m) d, AlgebraType0 (FreeMSet m) a) => (a -> d) -> FreeMSet m a -> d Source #codom :: AlgebraType0 (FreeMSet m) a => Proof (AlgebraType (FreeMSet m) (FreeMSet m a)) (FreeMSet m a) Source #forget :: AlgebraType (FreeMSet m) a => Proof (AlgebraType0 (FreeMSet m) a) (FreeMSet m a) Source # (Eq m, Eq a) => Eq (FreeMSet m a) Source # Instance detailsDefined in Data.Monoid.MSet Methods(==) :: FreeMSet m a -> FreeMSet m a -> Bool #(/=) :: FreeMSet m a -> FreeMSet m a -> Bool # (Ord m, Ord a) => Ord (FreeMSet m a) Source # Instance detailsDefined in Data.Monoid.MSet Methodscompare :: FreeMSet m a -> FreeMSet m a -> Ordering #(<) :: FreeMSet m a -> FreeMSet m a -> Bool #(<=) :: FreeMSet m a -> FreeMSet m a -> Bool #(>) :: FreeMSet m a -> FreeMSet m a -> Bool #(>=) :: FreeMSet m a -> FreeMSet m a -> Bool #max :: FreeMSet m a -> FreeMSet m a -> FreeMSet m a #min :: FreeMSet m a -> FreeMSet m a -> FreeMSet m a # (Show m, Show a) => Show (FreeMSet m a) Source # Instance detailsDefined in Data.Monoid.MSet MethodsshowsPrec :: Int -> FreeMSet m a -> ShowS #show :: FreeMSet m a -> String #showList :: [FreeMSet m a] -> ShowS # type AlgebraType0 (FreeMSet m :: Type -> Type) (a :: l) Source # Instance detailsDefined in Data.Monoid.MSet type AlgebraType0 (FreeMSet m :: Type -> Type) (a :: l) = () type AlgebraType (FreeMSet m :: Type -> Type) (a :: Type) Source # Instance detailsDefined in Data.Monoid.MSet type AlgebraType (FreeMSet m :: Type -> Type) (a :: Type) = MSet m a

Arguments

 :: (m -> n) monoid homomorphism -> FreeMSet m a -> FreeMSet n a

foldrMSet :: forall m a b. MSet m b => (a -> b -> b) -> b -> (m, a) -> b Source #

foldrFree for FreeMSet

newtype S s Source #

A newtype wrapper to avoid overlapping instances.

Constructors

 S FieldsrunS :: s
Instances
 Eq s => Eq (S s) Source # Instance detailsDefined in Data.Semigroup.SSet Methods(==) :: S s -> S s -> Bool #(/=) :: S s -> S s -> Bool # Ord s => Ord (S s) Source # Instance detailsDefined in Data.Semigroup.SSet Methodscompare :: S s -> S s -> Ordering #(<) :: S s -> S s -> Bool #(<=) :: S s -> S s -> Bool #(>) :: S s -> S s -> Bool #(>=) :: S s -> S s -> Bool #max :: S s -> S s -> S s #min :: S s -> S s -> S s # Show s => Show (S s) Source # Instance detailsDefined in Data.Semigroup.SSet MethodsshowsPrec :: Int -> S s -> ShowS #show :: S s -> String #showList :: [S s] -> ShowS # Semigroup m => Semigroup (S m) Source # Instance detailsDefined in Data.Semigroup.SSet Methods(<>) :: S m -> S m -> S m #sconcat :: NonEmpty (S m) -> S m #stimes :: Integral b => b -> S m -> S m # Monoid m => Monoid (S m) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsmempty :: S m #mappend :: S m -> S m -> S m #mconcat :: [S m] -> S m # SSet s a => SSet (S s) (Endo a) Source # Instance detailsDefined in Data.Semigroup.SSet Methodsact :: S s -> Endo a -> Endo a Source # MSet m b => MSet (S m) (Endo b) Source # Instance detailsDefined in Data.Monoid.MSet Methodsmact :: S m -> Endo b -> Endo b Source #