Safe Haskell | None |
---|---|
Language | Haskell2010 |
Monoid and group actions (M-Sets and G-Sets).
The category of MSet
s (and GSet
s) is monadic (unlike the category of SSet
s).
Synopsis
- class (Monoid m, SSet m a) => MSet m a where
- mact :: m -> a -> a
- class Semigroup s => SSet s a where
- act :: s -> a -> a
- newtype Endo a = Endo {
- appEndo :: a -> a
- rep :: SSet s a => s -> Endo a
- fact :: (Functor f, SSet s a) => s -> f a -> f a
- newtype FreeMSet m a = FreeMSet {
- runFreeMSet :: (m, a)
- hoistFreeMSet :: (m -> n) -> FreeMSet m a -> FreeMSet n a
- foldrMSet :: forall m a b. MSet m b => (a -> b -> b) -> b -> (m, a) -> b
- newtype S s = S {
- runS :: s
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
then an Group
MSet
is simply a GSet
, this
is because monoids and groups share the same morphisms (a monoid homomorphis
between groups necessarily preserves inverses).
Nothing
Instances
Monoid m => MSet m m Source # | |
Defined in Data.Monoid.MSet | |
MSet m a => MSet m (IO a) Source # | |
MSet m a => MSet m (Down a) Source # | |
MSet m a => MSet m (Maybe a) Source # | |
MSet m a => MSet m (Identity a) Source # | |
(MSet m a, Ord a) => MSet m (Set a) Source # | |
MSet m a => MSet m (NonEmpty a) Source # | |
MSet m a => MSet m [a] Source # | |
Defined in Data.Monoid.MSet | |
Monoid m => MSet m (FreeMSet m a) Source # | |
MSet m b => MSet m (a -> b) Source # | |
Defined in Data.Monoid.MSet | |
MSet m b => MSet m (Either a b) Source # | |
(MSet m a, MSet m b) => MSet m (a, b) Source # | |
Defined in Data.Monoid.MSet | |
MSet m a => MSet m (Const a b) Source # | |
(MSet m a, MSet m b, MSet m c) => MSet m (a, b, c) Source # | |
Defined in Data.Monoid.MSet | |
(Functor f, Functor h, MSet m a) => MSet m (Sum f h a) Source # | |
(Functor f, Functor h, MSet m a) => MSet m (Product f h a) Source # | |
(MSet m a, MSet m b, MSet m c, MSet m d) => MSet m (a, b, c, d) Source # | |
Defined in Data.Monoid.MSet | |
(MSet m a, MSet m b, MSet m c, MSet m d, MSet m e) => MSet m (a, b, c, d, e) Source # | |
Defined in Data.Monoid.MSet | |
(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 # | |
Defined in Data.Monoid.MSet | |
(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 # | |
Defined in Data.Monoid.MSet | |
(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 # | |
Defined in Data.Monoid.MSet | |
MSet m a => MSet (Identity m) a Source # | |
Defined in Data.Monoid.MSet | |
MSet (Endo a) a Source # | |
Defined in Data.Monoid.MSet | |
Num s => MSet (Sum s) s Source # | |
Defined in Data.Monoid.MSet | |
Monoid m => MSet (Sum Natural) m Source # | |
Num s => MSet (Product s) s Source # | |
Defined in Data.Monoid.MSet | |
MSet m b => MSet (S m) (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
then Group
is simply a MAct
gGSet
, this
is because monoids and groups share the same morphisms (a monoid homomorphis
between groups necessarily preserves inverses).
Instances
Semigroup s => SSet s s Source # | |
Defined in Data.Semigroup.SSet | |
SSet s a => SSet s (IO a) Source # | |
SSet s a => SSet s (Down a) Source # | |
SSet s a => SSet s (Maybe a) Source # | |
SSet s a => SSet s (Identity a) Source # | |
(SSet s a, Ord a) => SSet s (Set a) Source # | |
SSet s a => SSet s (NonEmpty a) Source # | |
SSet s a => SSet s [a] Source # | |
Defined in Data.Semigroup.SSet | |
SSet s b => SSet s (a -> b) Source # | |
Defined in Data.Semigroup.SSet | |
SSet s b => SSet s (Either a b) Source # | |
(SSet s a, SSet s b) => SSet s (a, b) Source # | |
Defined in Data.Semigroup.SSet | |
Semigroup m => SSet m (FreeMSet m a) Source # | |
SSet s a => SSet s (Const a b) Source # | |
(SSet s a, SSet s b, SSet s c) => SSet s (a, b, c) Source # | |
Defined in Data.Semigroup.SSet | |
(Functor f, Functor h, SSet s a) => SSet s (Sum f h a) Source # | |
(Functor f, Functor h, SSet s a) => SSet s (Product f h a) Source # | |
(SSet s a, SSet s b, SSet s c, SSet s d) => SSet s (a, b, c, d) Source # | |
Defined in Data.Semigroup.SSet | |
(SSet s a, SSet s b, SSet s c, SSet s d, SSet s e) => SSet s (a, b, c, d, e) Source # | |
Defined in Data.Semigroup.SSet | |
(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 # | |
Defined in Data.Semigroup.SSet | |
(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 # | |
Defined in Data.Semigroup.SSet | |
(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 # | |
Defined in Data.Semigroup.SSet | |
SSet s a => SSet (Identity s) a Source # | |
Defined in Data.Semigroup.SSet | |
SSet (Endo a) a Source # | |
Defined in Data.Semigroup.SSet | |
Group g => SSet (Sum Integer) g Source # | |
Num s => SSet (Sum s) s Source # | |
Defined in Data.Semigroup.SSet | |
Monoid s => SSet (Sum Natural) s Source # | |
Num s => SSet (Product s) s Source # | |
Defined in Data.Semigroup.SSet | |
SSet s a => SSet (S s) (Endo a) Source # | |
The monoid of endomorphisms under composition.
>>>
let computation = Endo ("Hello, " ++) <> Endo (++ "!")
>>>
appEndo computation "Haskell"
"Hello, Haskell!"
Instances
Generic (Endo a) | |
Semigroup (Endo a) | Since: base-4.9.0.0 |
Monoid (Endo a) | Since: base-2.1 |
SSet (Endo a) a Source # | |
Defined in Data.Semigroup.SSet | |
MSet (Endo a) a Source # | |
Defined in Data.Monoid.MSet | |
SSet s a => SSet (S s) (Endo a) Source # | |
MSet m b => MSet (S m) (Endo b) Source # | |
type Rep (Endo a) | Since: base-4.7.0.0 |
Defined in Data.Semigroup.Internal |
FreeMSet | |
|
Instances
Semigroup m => SSet m (FreeMSet m a) Source # | |
Monoid m => MSet m (FreeMSet m a) Source # | |
Monoid m => Monad (FreeMSet m) Source # | |
Functor (FreeMSet m) Source # | |
Monoid m => Applicative (FreeMSet m) Source # | |
Monoid m => FreeAlgebra (FreeMSet m) Source # | |
Defined in Data.Monoid.MSet returnFree :: 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 # | |
(Ord m, Ord a) => Ord (FreeMSet m a) Source # | |
Defined in Data.Monoid.MSet | |
(Show m, Show a) => Show (FreeMSet m a) Source # | |
type AlgebraType0 (FreeMSet m :: Type -> Type) (a :: l) Source # | |
Defined in Data.Monoid.MSet | |
type AlgebraType (FreeMSet m :: Type -> Type) (a :: Type) Source # | |
Defined in Data.Monoid.MSet |