Safe Haskell | None |
---|---|
Language | Haskell2010 |
Compatibility layer for Data.Semigroup
Documentation
class Semigroup a where Source #
The class of semigroups (types with an associative binary operation).
Since: 4.9.0.0
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
.
Identity of mappend
mappend :: a -> a -> a Source #
An associative operation
Fold a list using the monoid.
For most types, the default definition for mconcat
will be
used, but the function is included in the class definition so
that an optimized version can be provided for specific types.
Monoid Ordering | Since: 2.1 |
Monoid () | Since: 2.1 |
Monoid EventLifetime | Since: 4.8.0.0 |
Monoid Event | Since: 4.3.1.0 |
Monoid Lifetime |
Since: 4.8.0.0 |
Monoid All | Since: 2.1 |
Monoid Any | Since: 2.1 |
Monoid Builder | |
Monoid ByteString | |
Monoid ShortByteString | |
Monoid ByteString | |
Monoid IntSet | |
Monoid Doc | |
Monoid CDialect # | |
Monoid ForeignLibType # | |
Monoid ShortText # | |
Monoid TestSuiteInterface # | |
Monoid BenchmarkInterface # | |
Monoid UnqualComponentName # | |
Monoid SetupBuildInfo # | |
Monoid DependencyMap # | |
Monoid BuildInfo # | |
Monoid TestSuite # | |
Monoid Library # | |
Monoid ForeignLib # | |
Monoid Executable # | |
Monoid Benchmark # | |
Monoid BenchmarkFlags # | |
Monoid TestFlags # | |
Monoid TestShowDetails # | |
Monoid ReplFlags # | |
Monoid BuildFlags # | |
Monoid CleanFlags # | |
Monoid HaddockFlags # | |
Monoid HscolourFlags # | |
Monoid RegisterFlags # | |
Monoid SDistFlags # | |
Monoid InstallFlags # | |
Monoid CopyFlags # | |
Monoid ConfigFlags # | |
Monoid AllowOlder # | |
Monoid AllowNewer # | |
Monoid RelaxDeps # | |
Monoid GlobalFlags # | |
Monoid GhcOptions # | |
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 (Identity a) | |
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 (IntMap a) | |
Monoid (Seq a) | |
Ord a => Monoid (Set a) | |
Monoid (Doc a) | |
Monoid (PutM ()) | |
Monoid (Last' a) # | |
Monoid (DList a) # | |
Monoid (Condition a) # | |
(Semigroup dir, Monoid dir) => Monoid (InstallDirs dir) # | |
Ord a => Monoid (NubListR a) # | |
Ord a => Monoid (NubList a) # | Monoid operations on NubLists. For a valid Monoid instance we need to satistfy the required monoid laws; identity, associativity and closure. Identity : by inspection:
mempty Associativity : by inspection:
(NubList xs Closure : appending two lists of type a and removing duplicates obviously does not change the type. |
HasUnitId a => Monoid (PackageIndex a) # | |
Monoid (Flag a) # | |
Monoid b => Monoid (a -> b) | Since: 2.1 |
(Monoid a, Monoid b) => Monoid (a, b) | Since: 2.1 |
Monoid (Proxy k s) | Since: 4.7.0.0 |
Ord k => Monoid (Map k v) | |
(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 |
Boolean monoid under conjunction (&&
).
Boolean monoid under disjunction (||
).