free-algebras-0.1.0.1: Free algebras

Data.Semigroup.Abelian

Synopsis

# Documentation

class Semigroup m => AbelianSemigroup m Source #

Class of commutative monoids, e.g. with additional law:  a <> b = b <> a 

#### Instances

Instances details
 Source # Instance detailsDefined in Data.Semigroup.Abelian Source # Instance detailsDefined in Data.Semigroup.Abelian Source # Instance detailsDefined in Data.Semigroup.Abelian Source # Instance detailsDefined in Data.Semigroup.Abelian Source # Instance detailsDefined in Data.Semigroup.Abelian Ord a => AbelianSemigroup (Min a) Source # Instance detailsDefined in Data.Semigroup.Abelian Ord a => AbelianSemigroup (Max a) Source # Instance detailsDefined in Data.Semigroup.Abelian Source # Instance detailsDefined in Data.Semigroup.Abelian Source # Instance detailsDefined in Data.Semigroup.Abelian Num a => AbelianSemigroup (Sum a) Source # Instance detailsDefined in Data.Semigroup.Abelian Num a => AbelianSemigroup (Product a) Source # Instance detailsDefined in Data.Semigroup.Abelian Ord a => AbelianSemigroup (Set a) Source # Instance detailsDefined in Data.Semigroup.Abelian Source # Instance detailsDefined in Data.Semigroup.Abelian Source # Instance detailsDefined in Data.Monoid.Abelian Source # Instance detailsDefined in Data.Semigroup.Semilattice

Free abelian semigroup is isomorphic to a non empty map with keys a and values positive natural numbers.

It is a monad on the full subcategory which satisfies the Ord constraint, but base does not allow to define a functor / applicative / monad instances which are constraint by a class.

#### Instances

Instances details
 Source # Instance detailsDefined in Data.Semigroup.Abelian MethodsfoldMapFree :: (AlgebraType FreeAbelianSemigroup d, AlgebraType0 FreeAbelianSemigroup a) => (a -> d) -> FreeAbelianSemigroup a -> d Source # Eq a => Eq (FreeAbelianSemigroup a) Source # Instance detailsDefined in Data.Semigroup.Abelian Methods Ord a => Ord (FreeAbelianSemigroup a) Source # Instance detailsDefined in Data.Semigroup.Abelian Methods Show a => Show (FreeAbelianSemigroup a) Source # Instance detailsDefined in Data.Semigroup.Abelian MethodsshowList :: [FreeAbelianSemigroup a] -> ShowS # Source # Instance detailsDefined in Data.Semigroup.Abelian Methodsstimes :: Integral b => b -> FreeAbelianSemigroup a -> FreeAbelianSemigroup a # Source # Instance detailsDefined in Data.Semigroup.Abelian type AlgebraType0 FreeAbelianSemigroup (a :: Type) Source # Instance detailsDefined in Data.Semigroup.Abelian type AlgebraType0 FreeAbelianSemigroup (a :: Type) = Ord a type AlgebraType FreeAbelianSemigroup (a :: Type) Source # Instance detailsDefined in Data.Semigroup.Abelian type AlgebraType FreeAbelianSemigroup (a :: Type) = (Ord a, AbelianSemigroup a)

fromNonEmpty :: Ord a => NonEmpty (a, Natural) -> Maybe (FreeAbelianSemigroup a) Source #

Smart constructor which creates FreeAbelianSemigroup from a non empty list of pairs (a, n) :: (a, Natural) where n > 0.