| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Monoid.RightAction
Documentation
class RightAction m s where Source #
A right action of m on s.
Imagine s to be a type of states, and m a type of changes to s.
Laws:
- When
mis aSemigroup:s `actRight` m1 `actRight` m2 == s `actRight` (m1 <> m2) - When
mis aMonoid:s `actRight`mempty== s
The default implementation is the trivial action which leaves s unchanged.
See also Action from monoid-extras, which is a left action.
Minimal complete definition
Nothing
Instances
type REndo s = Dual (Endo s) Source #
Endomorphism type with reverse Monoid instance.
The standard Endo type has a left action on s since its composition is defined as Endo f <> Endo g = Endo (f . g).
The "Right Endomorphism" type, on the other hand, has a right action.
Intuitively, it behaves like the & operator:
s & f & g == s `actRight` rEndo f <> rEndo g