Safe Haskell | None |
---|---|
Language | Haskell98 |
Distribution.Compat.Semigroup
Description
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
Minimal complete definition
Nothing
Instances
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
.
Instances
Boolean monoid under conjunction (&&
).
Instances
Bounded All | |
Eq All | |
Data All | |
Ord All | |
Read All | |
Show All | |
Generic All | |
Semigroup All | |
Monoid All | |
NFData All | Since: 1.4.0.0 |
type Rep All = D1 (MetaData "All" "Data.Monoid" "base" True) (C1 (MetaCons "All" PrefixI True) (S1 (MetaSel (Just Symbol "getAll") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) |
Boolean monoid under disjunction (||
).
Instances
Bounded Any | |
Eq Any | |
Data Any | |
Ord Any | |
Read Any | |
Show Any | |
Generic Any | |
Semigroup Any | |
Monoid Any | |
NFData Any | Since: 1.4.0.0 |
type Rep Any = D1 (MetaData "Any" "Data.Monoid" "base" True) (C1 (MetaCons "Any" PrefixI True) (S1 (MetaSel (Just Symbol "getAny") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) |
Cabal's own Last
copy to avoid requiring an orphan
Binary
instance.
Once the oldest binary
version we support provides a Binary
instance for Last
we can remove this one here.
Instances
Functor Last' # | |
Applicative Last' # | |
Eq a => Eq (Last' a) # | |
Ord a => Ord (Last' a) # | |
Read a => Read (Last' a) # | |
Show a => Show (Last' a) # | |
Generic (Last' a) # | |
Semigroup (Last' a) # | |
Monoid (Last' a) # | |
Binary a => Binary (Last' a) # | |
type Rep (Last' a) = D1 (MetaData "Last'" "Distribution.Compat.Semigroup" "Cabal-1.24.0.0" True) (C1 (MetaCons "Last'" PrefixI True) (S1 (MetaSel (Just Symbol "getLast'") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe a)))) # |