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 => MSet m a
- class Semigroup s => SSet s a where
- 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 => MSet m a 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).
mact
Instances
Monoid m => MSet m m Source # | |
Defined in Data.Monoid.MSet mact :: m -> m -> m | |
MSet m a => MSet m (IO a) Source # | |
Defined in Data.Monoid.MSet | |
MSet m a => MSet m (Down a) Source # | |
Defined in Data.Monoid.MSet | |
MSet m a => MSet m (Maybe a) Source # | |
Defined in Data.Monoid.MSet | |
MSet m a => MSet m (Identity a) Source # | |
Defined in Data.Monoid.MSet | |
(MSet m a, Ord a) => MSet m (Set a) Source # | |
Defined in Data.Monoid.MSet | |
MSet m a => MSet m (NonEmpty a) Source # | |
Defined in Data.Monoid.MSet | |
MSet m a => MSet m [a] Source # | |
Defined in Data.Monoid.MSet mact :: m -> [a] -> [a] | |
Monoid m => MSet m (FreeMSet m a) Source # | |
Defined in Data.Monoid.MSet | |
MSet m b => MSet m (a -> b) Source # | |
Defined in Data.Monoid.MSet mact :: m -> (a -> b) -> a -> b | |
MSet m b => MSet m (Either a b) Source # | |
Defined in Data.Monoid.MSet | |
(MSet m a, MSet m b) => MSet m (a, b) Source # | |
Defined in Data.Monoid.MSet mact :: m -> (a, b) -> (a, b) | |
MSet m a => MSet m (Const a b) Source # | |
Defined in Data.Monoid.MSet | |
(MSet m a, MSet m b, MSet m c) => MSet m (a, b, c) Source # | |
Defined in Data.Monoid.MSet mact :: m -> (a, b, c) -> (a, b, c) | |
(Functor f, Functor h, MSet m a) => MSet m (Sum f h a) Source # | |
Defined in Data.Monoid.MSet | |
(Functor f, Functor h, MSet m a) => MSet m (Product f h a) Source # | |
Defined in Data.Monoid.MSet | |
(MSet m a, MSet m b, MSet m c, MSet m d) => MSet m (a, b, c, d) Source # | |
Defined in Data.Monoid.MSet mact :: m -> (a, b, c, d) -> (a, b, c, d) | |
(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 mact :: m -> (a, b, c, d, e) -> (a, b, c, d, e) | |
(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 mact :: m -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) | |
(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 mact :: m -> (a, b, c, d, e, f, h) -> (a, b, c, d, e, f, h) | |
(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 mact :: m -> (a, b, c, d, e, f, h, i) -> (a, b, c, d, e, f, h, i) | |
MSet m a => MSet (Identity m) a Source # | |
Defined in Data.Monoid.MSet | |
MSet (Endo a) a Source # | |
Defined in Data.Monoid.MSet | |
Monoid m => MSet (Sum Natural) m Source # | |
Defined in Data.Monoid.MSet | |
MSet m a => MSet (S m) a Source # | |
Defined in Data.Monoid.MSet | |
MSet m b => MSet (S m) (Endo b) Source # | |
Defined in Data.Monoid.MSet |
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 (Endo a) Source # | |
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 # | |
Monoid s => SSet (Sum Natural) s Source # | |
The monoid of endomorphisms under composition.
>>>
let computation = Endo ("Hello, " ++) <> Endo (++ "!")
>>>
appEndo computation "Haskell"
"Hello, Haskell!"
Instances
SSet s a => SSet s (Endo a) Source # | |
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 | |
MSet m b => MSet (S m) (Endo b) Source # | |
Defined in Data.Monoid.MSet | |
type Rep (Endo a) | |
Defined in Data.Semigroup.Internal |
FreeMSet | |
|