Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
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 =
foldr
mappend 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 newtype
s and make those instances
of Monoid
, e.g. Sum
and Product
.
Monoid Ordering | Since: 2.1 |
Monoid () | Since: 2.1 |
Monoid All | Since: 2.1 |
Monoid Any | Since: 2.1 |
Monoid [a] | Since: 2.1 |
Monoid a => Monoid (Maybe a) | Lift a semigroup into Since: 2.1 |
Monoid a => Monoid (IO a) | Since: 4.9.0.0 |
(Ord a, Bounded a) => Monoid (Min a) | Since: 4.9.0.0 |
(Ord a, Bounded a) => Monoid (Max a) | Since: 4.9.0.0 |
Monoid m => Monoid (WrappedMonoid m) | Since: 4.9.0.0 |
Semigroup a => Monoid (Option a) | Since: 4.9.0.0 |
Monoid a => Monoid (Dual a) | Since: 2.1 |
Monoid (Endo a) | Since: 2.1 |
Num a => Monoid (Sum a) | Since: 2.1 |
Num a => Monoid (Product a) | Since: 2.1 |
Monoid (First a) | Since: 2.1 |
Monoid (Last a) | Since: 2.1 |
Monoid b => Monoid (a -> b) | Since: 2.1 |
(Monoid a, Monoid b) => Monoid (a, b) | Since: 2.1 |
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) | Since: 2.1 |
Monoid a => Monoid (Const k a b) | |
Alternative f => Monoid (Alt * f a) | Since: 4.8.0.0 |
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) | Since: 2.1 |
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) | Since: 2.1 |
Monad Dual | Since: 4.8.0.0 |
Functor Dual | Since: 4.8.0.0 |
Applicative Dual | Since: 4.8.0.0 |
Foldable Dual | Since: 4.8.0.0 |
Traversable Dual | Since: 4.8.0.0 |
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) | Since: 4.9.0.0 |
Monoid a => Monoid (Dual a) | Since: 2.1 |
Generic1 * Dual | |
type Rep (Dual a) | |
type Rep1 * Dual | |
The monoid of endomorphisms under composition.
Boolean monoid under conjunction (&&
).
Boolean monoid under disjunction (||
).
Monoid under addition.
Monad Sum | Since: 4.8.0.0 |
Functor Sum | Since: 4.8.0.0 |
Applicative Sum | Since: 4.8.0.0 |
Foldable Sum | Since: 4.8.0.0 |
Traversable Sum | Since: 4.8.0.0 |
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) | Since: 4.9.0.0 |
Num a => Monoid (Sum a) | Since: 2.1 |
Generic1 * Sum | |
type Rep (Sum a) | |
type Rep1 * Sum | |
Monoid under multiplication.
Monad Product | Since: 4.8.0.0 |
Functor Product | Since: 4.8.0.0 |
Applicative Product | Since: 4.8.0.0 |
Foldable Product | Since: 4.8.0.0 |
Traversable Product | Since: 4.8.0.0 |
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) | Since: 4.9.0.0 |
Num a => Monoid (Product a) | Since: 2.1 |
Generic1 * Product | |
type Rep (Product a) | |
type Rep1 * Product | |