| Maintainer | bastiaan.heeren@ou.nl |
|---|---|
| Stability | provisional |
| Portability | portable (depends on ghc) |
| Safe Haskell | None |
| Language | Haskell2010 |
Domain.Algebra.Group
Description
Synopsis
- class Semigroup a => Monoid a where
- (<>) :: Semigroup a => a -> a -> a
- class Monoid a => Group a where
- (<>-) :: Group a => a -> a -> a
- class Monoid a => MonoidZero a where
- data WithZero a
- fromWithZero :: WithZero a -> Maybe a
- class CoMonoid a where
- class CoMonoid a => CoGroup a where
- class CoMonoid a => CoMonoidZero a where
- associativeList :: CoMonoid a => a -> [a]
Monoids
class Semigroup a => Monoid a where #
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:
x
<>mempty= xmempty<>x = xx(<>(y<>z) = (x<>y)<>zSemigrouplaw)mconcat=foldr'(<>)'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 newtypes and make those instances
of Monoid, e.g. Sum and Product.
NOTE: Semigroup is a superclass of Monoid since base-4.11.0.0.
Minimal complete definition
Methods
Identity of mappend
An associative operation
NOTE: This method is redundant and has the default
implementation since base-4.11.0.0.mappend = '(<>)'
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.
Instances
| Monoid Ordering | Since: base-2.1 |
| Monoid () | Since: base-2.1 |
| Monoid All | Since: base-2.1 |
| Monoid Any | Since: base-2.1 |
| Monoid ByteString | |
Defined in Data.ByteString.Lazy.Internal Methods mempty :: ByteString # mappend :: ByteString -> ByteString -> ByteString # mconcat :: [ByteString] -> ByteString # | |
| Monoid ByteString | |
Defined in Data.ByteString.Internal Methods mempty :: ByteString # mappend :: ByteString -> ByteString -> ByteString # mconcat :: [ByteString] -> ByteString # | |
| Monoid IntSet | |
| Monoid Id | |
| Monoid Latex | |
| Monoid Environment | |
| Monoid Message | |
| Monoid Rating | |
| Monoid Result | |
| Monoid Status | |
| Monoid TestSuite | |
| Monoid StrategyCfg | |
| Monoid Location | |
| Monoid [a] | Since: base-2.1 |
| Semigroup a => Monoid (Maybe a) | Lift a semigroup into Since 4.11.0: constraint on inner Since: base-2.1 |
| Monoid a => Monoid (IO a) | Since: base-4.9.0.0 |
| (Ord a, Bounded a) => Monoid (Min a) | Since: base-4.9.0.0 |
| (Ord a, Bounded a) => Monoid (Max a) | Since: base-4.9.0.0 |
| Monoid m => Monoid (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods mempty :: WrappedMonoid m # mappend :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # mconcat :: [WrappedMonoid m] -> WrappedMonoid m # | |
| Semigroup a => Monoid (Option a) | Since: base-4.9.0.0 |
| Monoid a => Monoid (Identity a) | |
| Monoid (First a) | Since: base-2.1 |
| Monoid (Last a) | Since: base-2.1 |
| Monoid a => Monoid (Dual a) | Since: base-2.1 |
| Monoid (Endo a) | Since: base-2.1 |
| Num a => Monoid (Sum a) | Since: base-2.1 |
| Num a => Monoid (Product a) | Since: base-2.1 |
| Monoid (IntMap a) | |
| Monoid (Seq a) | |
| Ord a => Monoid (Set a) | |
| Monoid a => Monoid (WithZero a) # | |
| Monoid (MergeSet a) | |
| SemiRing a => Monoid (Multiplicative a) # | |
Defined in Domain.Algebra.Field Methods mempty :: Multiplicative a # mappend :: Multiplicative a -> Multiplicative a -> Multiplicative a # mconcat :: [Multiplicative a] -> Multiplicative a # | |
| SemiRing a => Monoid (Additive a) # | |
| Boolean a => Monoid (Or a) # | |
| Boolean a => Monoid (And a) # | |
| (CoGroup a, Group a) => Monoid (SmartGroup a) # | |
Defined in Domain.Algebra.SmartGroup Methods mempty :: SmartGroup a # mappend :: SmartGroup a -> SmartGroup a -> SmartGroup a # mconcat :: [SmartGroup a] -> SmartGroup a # | |
| (CoMonoidZero a, MonoidZero a) => Monoid (SmartZero a) # | |
| (CoMonoid a, Monoid a) => Monoid (Smart a) # | |
| Monoid (Examples a) | |
| Ord a => Monoid (OrSet a) # | |
| Monoid (OrList a) # | |
| Monoid (Recognizer a) | |
| Monoid (Prefix a) | |
| Monoid (Option a) | |
| Monoid b => Monoid (a -> b) | Since: base-2.1 |
| (Monoid a, Monoid b) => Monoid (a, b) | Since: base-2.1 |
| Monoid (Proxy s) | Since: base-4.7.0.0 |
| Ord k => Monoid (Map k v) | |
| Monoid (Trans a b) | |
| (Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) | Since: base-2.1 |
| Monoid a => Monoid (Const a b) | |
| Alternative f => Monoid (Alt f a) | Since: base-4.8.0.0 |
| Monoid a => Monoid (Constant a b) | |
| (Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) | Since: base-2.1 |
| (Monoid a, Semigroup (ParsecT s u m a)) => Monoid (ParsecT s u m a) | The Since: parsec-3.1.12 |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) | Since: base-2.1 |
Groups
class Monoid a => Group a where Source #
Minimal complete definition: inverse or appendInverse
Instances
| Field a => Group (Multiplicative a) Source # | |
Defined in Domain.Algebra.Field Methods inverse :: Multiplicative a -> Multiplicative a Source # appendInv :: Multiplicative a -> Multiplicative a -> Multiplicative a Source # | |
| Ring a => Group (Additive a) Source # | |
| (CoGroup a, Group a) => Group (SmartGroup a) Source # | |
Defined in Domain.Algebra.SmartGroup Methods inverse :: SmartGroup a -> SmartGroup a Source # appendInv :: SmartGroup a -> SmartGroup a -> SmartGroup a Source # | |
Monoids with a zero element
class Monoid a => MonoidZero a where Source #
Minimal complete definition
Instances
| Monoid a => MonoidZero (WithZero a) Source # | |
Defined in Domain.Algebra.Group | |
| SemiRing a => MonoidZero (Multiplicative a) Source # | |
Defined in Domain.Algebra.Field Methods mzero :: Multiplicative a Source # | |
| Boolean a => MonoidZero (Or a) Source # | |
Defined in Domain.Algebra.Boolean | |
| Boolean a => MonoidZero (And a) Source # | |
Defined in Domain.Algebra.Boolean | |
| (MonoidZero a, CoGroup a, Group a) => MonoidZero (SmartGroup a) Source # | |
Defined in Domain.Algebra.SmartGroup Methods mzero :: SmartGroup a Source # | |
| (MonoidZero a, CoMonoidZero a) => MonoidZero (SmartZero a) Source # | |
Defined in Domain.Algebra.SmartGroup | |
| (MonoidZero a, CoMonoid a) => MonoidZero (Smart a) Source # | |
Defined in Domain.Algebra.SmartGroup | |
| Ord a => MonoidZero (OrSet a) Source # | |
Defined in Domain.Math.Data.OrList | |
| MonoidZero (OrList a) Source # | |
Defined in Domain.Math.Data.OrList | |
Instances
fromWithZero :: WithZero a -> Maybe a Source #
CoMonoid, CoGroup, and CoMonoidZero (for matching)
class CoMonoid a where Source #
Instances
| CoMonoid [a] Source # | |
| CoMonoid (Set a) Source # | |
| CoMonoid a => CoMonoid (WithZero a) Source # | |
| CoSemiRing a => CoMonoid (Multiplicative a) Source # | |
Defined in Domain.Algebra.Field Methods isEmpty :: Multiplicative a -> Bool Source # isAppend :: Multiplicative a -> Maybe (Multiplicative a, Multiplicative a) Source # | |
| CoSemiRing a => CoMonoid (Additive a) Source # | |
| CoBoolean a => CoMonoid (Or a) Source # | |
| CoBoolean a => CoMonoid (And a) Source # | |
| CoMonoid a => CoMonoid (SmartGroup a) Source # | |
Defined in Domain.Algebra.SmartGroup Methods isEmpty :: SmartGroup a -> Bool Source # isAppend :: SmartGroup a -> Maybe (SmartGroup a, SmartGroup a) Source # | |
| CoMonoid a => CoMonoid (SmartZero a) Source # | |
| CoMonoid a => CoMonoid (Smart a) Source # | |
| CoMonoid (OrSet a) Source # | |
| CoMonoid (OrList a) Source # | |
class CoMonoid a => CoGroup a where Source #
Minimal complete definition
Instances
| CoField a => CoGroup (Multiplicative a) Source # | |
Defined in Domain.Algebra.Field Methods isInverse :: Multiplicative a -> Maybe (Multiplicative a) Source # isAppendInv :: Multiplicative a -> Maybe (Multiplicative a, Multiplicative a) Source # | |
| CoRing a => CoGroup (Additive a) Source # | |
| CoGroup a => CoGroup (SmartGroup a) Source # | |
Defined in Domain.Algebra.SmartGroup Methods isInverse :: SmartGroup a -> Maybe (SmartGroup a) Source # isAppendInv :: SmartGroup a -> Maybe (SmartGroup a, SmartGroup a) Source # | |
class CoMonoid a => CoMonoidZero a where Source #
Minimal complete definition
Methods
isMonoidZero :: a -> Bool Source #
Instances
associativeList :: CoMonoid a => a -> [a] Source #