| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Basement.Compat.Semigroup
- class Semigroup a where
- type ListNonEmpty = NonEmpty
Documentation
The class of semigroups (types with an associative binary operation).
Since: 4.9.0.0
Methods
(<>) :: a -> a -> a infixr 6 #
An associative operation.
(a<>b)<>c = a<>(b<>c)
If a is also a Monoid we further require
(<>) =mappend
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 = stimesIdempotent or stimes = stimesIdempotentMonoid
respectively.
Instances
| Semigroup Ordering | Since: 4.9.0.0 |
| Semigroup () | Since: 4.9.0.0 |
| Semigroup Void | Since: 4.9.0.0 |
| Semigroup Event | Since: 4.10.0.0 |
| Semigroup Lifetime | Since: 4.10.0.0 |
| Semigroup All | Since: 4.9.0.0 |
| Semigroup Any | Since: 4.9.0.0 |
| Semigroup AsciiString # | |
| Semigroup String # | |
| Semigroup Builder # | |
| Semigroup Builder # | |
| Semigroup [a] | Since: 4.9.0.0 |
| Semigroup a => Semigroup (Maybe a) | Since: 4.9.0.0 |
| Semigroup a => Semigroup (IO a) | Since: 4.10.0.0 |
| Ord a => Semigroup (Min a) | Since: 4.9.0.0 |
| Ord a => Semigroup (Max a) | Since: 4.9.0.0 |
| Semigroup (First a) | Since: 4.9.0.0 |
| Semigroup (Last a) | Since: 4.9.0.0 |
| Monoid m => Semigroup (WrappedMonoid m) | Since: 4.9.0.0 |
| Semigroup a => Semigroup (Option a) | Since: 4.9.0.0 |
| Semigroup (NonEmpty a) | Since: 4.9.0.0 |
| Semigroup a => Semigroup (Identity a) | Since: 4.9.0.0 |
| Semigroup a => Semigroup (Dual a) | Since: 4.9.0.0 |
| Semigroup (Endo a) | Since: 4.9.0.0 |
| Num a => Semigroup (Sum a) | Since: 4.9.0.0 |
| Num a => Semigroup (Product a) | Since: 4.9.0.0 |
| Semigroup (First a) | Since: 4.9.0.0 |
| Semigroup (Last a) | Since: 4.9.0.0 |
| Semigroup (CountOf ty) # | |
| PrimType ty => Semigroup (Block ty) # | |
| PrimType ty => Semigroup (UArray ty) # | |
| Semigroup (Array a) # | |
| Semigroup b => Semigroup (a -> b) | Since: 4.9.0.0 |
| Semigroup (Either a b) | Since: 4.9.0.0 |
| (Semigroup a, Semigroup b) => Semigroup (a, b) | Since: 4.9.0.0 |
| Semigroup (Proxy k s) | Since: 4.9.0.0 |
| (Semigroup a, Semigroup b, Semigroup c) => Semigroup (a, b, c) | Since: 4.9.0.0 |
| Semigroup a => Semigroup (Const k a b) | Since: 4.9.0.0 |
| Alternative f => Semigroup (Alt * f a) | Since: 4.9.0.0 |
| (Semigroup a, Semigroup b, Semigroup c, Semigroup d) => Semigroup (a, b, c, d) | Since: 4.9.0.0 |
| (Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e) => Semigroup (a, b, c, d, e) | Since: 4.9.0.0 |
type ListNonEmpty = NonEmpty Source #