| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Papa.Base.Export.Data.Monoid
Documentation
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:
mappend mempty x = x
mappend x mempty = x
mappend x (mappend y z) = mappend (mappend x y) z
mconcat =
foldrmappend mempty
The method names refer to the monoid of lists under concatenation, but there are many other instances.
Some types can be viewed as a monoid in more than one way,
e.g. both addition and multiplication on numbers.
In such cases we often define newtypes and make those instances
of Monoid, e.g. Sum and Product.
Instances
| Monoid Ordering | |
| Monoid () | |
| Monoid All | |
| Monoid Any | |
| Monoid [a] | |
| Monoid a => Monoid (Maybe a) | Lift a semigroup into |
| Monoid a => Monoid (IO a) | |
| Ord a => Monoid (Max a) | |
| Ord a => Monoid (Min a) | |
| (Ord a, Bounded a) => Monoid (Min a) | |
| (Ord a, Bounded a) => Monoid (Max a) | |
| Monoid m => Monoid (WrappedMonoid m) | |
| Semigroup a => Monoid (Option a) | |
| Monoid a => Monoid (Dual a) | |
| Monoid (Endo a) | |
| Num a => Monoid (Sum a) | |
| Num a => Monoid (Product a) | |
| Monoid (First a) | |
| Monoid (Last a) | |
| Monoid b => Monoid (a -> b) | |
| (Monoid a, Monoid b) => Monoid (a, b) | |
| Monoid (Proxy k s) | |
| (Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) | |
| Monoid a => Monoid (Const k a b) | |
| Alternative f => Monoid (Alt * f a) | |
| (Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) | |
Instances
| Monad Dual | |
| Functor Dual | |
| Applicative Dual | |
| Foldable Dual | |
| Traversable Dual | |
| Generic1 Dual | |
| Bounded a => Bounded (Dual a) | |
| Eq a => Eq (Dual a) | |
| Ord a => Ord (Dual a) | |
| Read a => Read (Dual a) | |
| Show a => Show (Dual a) | |
| Generic (Dual a) | |
| Semigroup a => Semigroup (Dual a) | |
| Monoid a => Monoid (Dual a) | |
| type Rep1 Dual | |
| type Rep (Dual a) | |
The monoid of endomorphisms under composition.
Boolean monoid under conjunction (&&).
Boolean monoid under disjunction (||).
Monoid under addition.
Instances
| Monad Sum | |
| Functor Sum | |
| Applicative Sum | |
| Foldable Sum | |
| Traversable Sum | |
| Generic1 Sum | |
| Bounded a => Bounded (Sum a) | |
| Eq a => Eq (Sum a) | |
| Num a => Num (Sum a) | |
| Ord a => Ord (Sum a) | |
| Read a => Read (Sum a) | |
| Show a => Show (Sum a) | |
| Generic (Sum a) | |
| Num a => Semigroup (Sum a) | |
| Num a => Monoid (Sum a) | |
| type Rep1 Sum | |
| type Rep (Sum a) | |
Monoid under multiplication.
Instances
| Monad Product | |
| Functor Product | |
| Applicative Product | |
| Foldable Product | |
| Traversable Product | |
| Generic1 Product | |
| Bounded a => Bounded (Product a) | |
| Eq a => Eq (Product a) | |
| Num a => Num (Product a) | |
| Ord a => Ord (Product a) | |
| Read a => Read (Product a) | |
| Show a => Show (Product a) | |
| Generic (Product a) | |
| Num a => Semigroup (Product a) | |
| Num a => Monoid (Product a) | |
| type Rep1 Product | |
| type Rep (Product a) | |