Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type family Monoids lst :: Constraint where ...
- class (Mempty a, Semigroup a) => Monoid a where
- mconcat :: [a] -> a
- type family Semigroups lst :: Constraint where ...
- type family Mempties lst :: Constraint where ...
- class Mempty a where
- mempty :: a
- mappend :: Semigroup a => a -> a -> a
- mappendWith :: Semigroup a => a -> a -> a -> a
- mappendBetween :: Semigroup a => a -> a -> a -> a
- mconcat' :: (Foldable t, Monoid a) => t a -> a
- intersperse :: Foldable f => a -> f a -> [a]
- intercalate :: (Monoid a, Foldable f) => a -> f a -> a
- intercalate' :: Monoid a => a -> [a] -> a
- class Semigroup a where
Documentation
type family Monoids lst :: Constraint where ... Source #
type family Semigroups lst :: Constraint where ... Source #
Semigroups '[] = () | |
Semigroups (a ': as) = (Semigroup a, Semigroups as) |
type family Mempties lst :: Constraint where ... Source #
Nothing
Instances
Monoid a => Mempty a Source # | |
Defined in Data.Monoids | |
Mempty [a] Source # | |
Defined in Data.Monoids | |
Mempty (Maybe a) Source # | |
Defined in Data.Monoids | |
Mempty (Map k a) Source # | |
Defined in Data.Monoids |
mappendWith :: Semigroup a => a -> a -> a -> a Source #
mappendBetween :: Semigroup a => a -> a -> a -> a Source #
intersperse :: Foldable f => a -> f a -> [a] Source #
intercalate :: (Monoid a, Foldable f) => a -> f a -> a Source #
intercalate' :: Monoid a => a -> [a] -> a Source #
The class of semigroups (types with an associative binary operation).
Instances should satisfy the associativity law:
Since: base-4.9.0.0
(<>) :: a -> a -> a infixr 6 #
An associative operation.
Reduce a non-empty list with <>
The default definition should be sufficient, but this can be overridden for efficiency.
stimes :: Integral b => b -> a -> a #
Repeat a value n
times.
Given that this works on a Semigroup
it is allowed to fail if
you request 0 or fewer repetitions, and the default definition
will do so.
By making this a member of the class, idempotent semigroups
and monoids can upgrade this to execute in O(1) by
picking stimes =
or stimesIdempotent
stimes =
respectively.stimesIdempotentMonoid
Instances
Semigroup Ordering | Since: base-4.9.0.0 |
Semigroup () | Since: base-4.9.0.0 |
Semigroup [a] | Since: base-4.9.0.0 |
Semigroup a => Semigroup (Maybe a) | Since: base-4.9.0.0 |
Semigroup a => Semigroup (IO a) | Since: base-4.10.0.0 |
Ord a => Semigroup (Min a) | Since: base-4.9.0.0 |
Ord a => Semigroup (Max a) | Since: base-4.9.0.0 |
Semigroup (First a) | Since: base-4.9.0.0 |
Semigroup (Last a) | Since: base-4.9.0.0 |
Monoid m => Semigroup (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup (<>) :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # sconcat :: NonEmpty (WrappedMonoid m) -> WrappedMonoid m # stimes :: Integral b => b -> WrappedMonoid m -> WrappedMonoid m # | |
Semigroup a => Semigroup (Option a) | Since: base-4.9.0.0 |
Semigroup (First a) | Since: base-4.9.0.0 |
Semigroup (Last a) | Since: base-4.9.0.0 |
Semigroup (NonEmpty a) | Since: base-4.9.0.0 |
Semigroup b => Semigroup (a -> b) | Since: base-4.9.0.0 |
Semigroup (Either a b) | Since: base-4.9.0.0 |
(Semigroup a, Semigroup b) => Semigroup (a, b) | Since: base-4.9.0.0 |
Ord k => Semigroup (Map k v) | |
(Semigroup a, Semigroup b, Semigroup c) => Semigroup (a, b, c) | Since: base-4.9.0.0 |
(Applicative f, Semigroup a) => Semigroup (Ap f a) | Since: base-4.12.0.0 |
(Semigroup a, Semigroup b, Semigroup c, Semigroup d) => Semigroup (a, b, c, d) | Since: base-4.9.0.0 |
(Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e) => Semigroup (a, b, c, d, e) | Since: base-4.9.0.0 |