ideas-1.5: Feedback services for intelligent tutoring systems

Maintainerbastiaan.heeren@ou.nl
Stabilityprovisional
Portabilityportable (depends on ghc)
Safe HaskellNone
LanguageHaskell98

Ideas.Common.Algebra.Group

Contents

Description

 

Synopsis

Monoids

class Monoid a where

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 newtypes and make those instances of Monoid, e.g. Sum and Product.

Minimal complete definition

mempty, mappend

Methods

mempty :: a

Identity of mappend

mappend :: a -> a -> a

An associative operation

mconcat :: [a] -> a

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 
Monoid () 
Monoid All 
Monoid Any 
Monoid ByteString 
Monoid ByteString 
Monoid IntSet 
Monoid Doc 
Monoid XMLBuilder 
Monoid Rating 
Monoid Status 
Monoid Message 
Monoid Result 
Monoid TestSuite 
Monoid Location 
Monoid Id 
Monoid Environment 
Monoid Substitution 
Monoid StrategyCfg 
Monoid Text 
Monoid Script 
Monoid DomainReasoner 
Monoid [a] 
Ord a => Monoid (Max a) 
Ord a => Monoid (Min a) 
Monoid a => Monoid (Dual a) 
Monoid (Endo a) 
Num a => Monoid (Sum a) 
Num a => Monoid (Product a) 
Monoid (First a) 
Monoid (Last a) 
Monoid a => Monoid (Maybe a)

Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S." Since there is no "Semigroup" typeclass providing just mappend, we use Monoid instead.

Monoid (IntMap a) 
Ord a => Monoid (Set a) 
Monoid (Seq a) 
Monoid (ArbGen a) 
Monoid (Recognizer a) 
Monoid (Prefix a) 
Monoid (Option a) 
Monoid a => Monoid (WithZero a) 
SemiRing a => Monoid (Multiplicative a) 
SemiRing a => Monoid (Additive a) 
Boolean a => Monoid (Or a) 
Boolean a => Monoid (And a) 
(CoGroup a, Group a) => Monoid (SmartGroup a) 
(CoMonoidZero a, MonoidZero a) => Monoid (SmartZero a) 
(CoMonoid a, Monoid a) => Monoid (Smart a) 
Monoid b => Monoid (a -> b) 
(Monoid a, Monoid b) => Monoid (a, b) 
Monoid a => Monoid (Const a b) 
Monoid (Proxy k s) 
Ord k => Monoid (Map k v) 
Monoid (Trans a b) 
(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) 
Alternative f => Monoid (Alt * f a) 
Monoid t => Monoid (Encoder a s t) 
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) 
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) 

(<>) :: Monoid m => m -> m -> m infixr 6

An infix synonym for mappend.

Since: 4.5.0.0

Groups

class Monoid a => Group a where Source

Minimal complete definition: inverse or appendInverse

Minimal complete definition

Nothing

Methods

inverse :: a -> a Source

appendInv :: a -> a -> a Source

(<>-) :: Group a => a -> a -> a infixl 6 Source

Monoids with a zero element

CoMonoid, CoGroup, and CoMonoidZero (for matching)

class CoMonoid a => CoGroup a where Source

Minimal complete definition

isInverse

Methods

isInverse :: a -> Maybe a Source

isAppendInv :: a -> Maybe (a, a) Source