free-algebras-0.0.5.1: Free algebras in Haskell.

Safe HaskellSafe
LanguageHaskell2010

Data.Group.Free

Description

Synopsis

Documentation

data FreeGroup a Source #

Free group generated by a type a. Internally it's represented by a list [Either a a] where inverse is given by:

 inverse (FreeGroup [a]) = FreeGroup [either Right Left a]

It is a monad on a full subcategory of Hask which constists of types which satisfy the Eq constraint.

FreeGroup a is isomorphic with Free Group a (but the latter does not require Eq constraint, hence is more general).

Instances
Monad FreeGroup Source # 
Instance details

Defined in Data.Group.Free

Methods

(>>=) :: FreeGroup a -> (a -> FreeGroup b) -> FreeGroup b #

(>>) :: FreeGroup a -> FreeGroup b -> FreeGroup b #

return :: a -> FreeGroup a #

fail :: String -> FreeGroup a #

Functor FreeGroup Source # 
Instance details

Defined in Data.Group.Free

Methods

fmap :: (a -> b) -> FreeGroup a -> FreeGroup b #

(<$) :: a -> FreeGroup b -> FreeGroup a #

Applicative FreeGroup Source # 
Instance details

Defined in Data.Group.Free

Methods

pure :: a -> FreeGroup a #

(<*>) :: FreeGroup (a -> b) -> FreeGroup a -> FreeGroup b #

liftA2 :: (a -> b -> c) -> FreeGroup a -> FreeGroup b -> FreeGroup c #

(*>) :: FreeGroup a -> FreeGroup b -> FreeGroup b #

(<*) :: FreeGroup a -> FreeGroup b -> FreeGroup a #

FreeAlgebra FreeGroup Source # 
Instance details

Defined in Data.Group.Free

Eq a => Eq (FreeGroup a) Source # 
Instance details

Defined in Data.Group.Free

Methods

(==) :: FreeGroup a -> FreeGroup a -> Bool #

(/=) :: FreeGroup a -> FreeGroup a -> Bool #

Ord a => Ord (FreeGroup a) Source # 
Instance details

Defined in Data.Group.Free

Show a => Show (FreeGroup a) Source # 
Instance details

Defined in Data.Group.Free

Eq a => Semigroup (FreeGroup a) Source # 
Instance details

Defined in Data.Group.Free

Methods

(<>) :: FreeGroup a -> FreeGroup a -> FreeGroup a #

sconcat :: NonEmpty (FreeGroup a) -> FreeGroup a #

stimes :: Integral b => b -> FreeGroup a -> FreeGroup a #

Eq a => Monoid (FreeGroup a) Source # 
Instance details

Defined in Data.Group.Free

Eq a => Group (FreeGroup a) Source # 
Instance details

Defined in Data.Group.Free

Methods

invert :: FreeGroup a -> FreeGroup a #

pow :: Integral x => FreeGroup a -> x -> FreeGroup a #

type AlgebraType0 FreeGroup (a :: *) Source # 
Instance details

Defined in Data.Group.Free

type AlgebraType0 FreeGroup (a :: *) = Eq a
type AlgebraType FreeGroup (g :: *) Source # 
Instance details

Defined in Data.Group.Free

type AlgebraType FreeGroup (g :: *) = (Eq g, Group g)

fromDList :: Eq a => DList (Either a a) -> FreeGroup a Source #

Smart constructor which normalizes a list.

normalize :: Eq a => DList (Either a a) -> DList (Either a a) Source #

Normalize a list, i.e. remove adjusten inverses from a word, i.e. ab⁻¹ba⁻¹c = c

Complexity: O(n)

data FreeGroupL a Source #

Free group in the class of groups which multiplication is strict on the left, i.e.

undefined <> a = undefined
Instances
FreeAlgebra FreeGroupL Source # 
Instance details

Defined in Data.Group.Free

Eq a => Eq (FreeGroupL a) Source # 
Instance details

Defined in Data.Group.Free

Methods

(==) :: FreeGroupL a -> FreeGroupL a -> Bool #

(/=) :: FreeGroupL a -> FreeGroupL a -> Bool #

Ord a => Ord (FreeGroupL a) Source # 
Instance details

Defined in Data.Group.Free

Show a => Show (FreeGroupL a) Source # 
Instance details

Defined in Data.Group.Free

Eq a => Semigroup (FreeGroupL a) Source # 
Instance details

Defined in Data.Group.Free

Eq a => Monoid (FreeGroupL a) Source # 
Instance details

Defined in Data.Group.Free

Eq a => Group (FreeGroupL a) Source # 
Instance details

Defined in Data.Group.Free

Methods

invert :: FreeGroupL a -> FreeGroupL a #

pow :: Integral x => FreeGroupL a -> x -> FreeGroupL a #

type AlgebraType0 FreeGroupL (a :: *) Source # 
Instance details

Defined in Data.Group.Free

type AlgebraType0 FreeGroupL (a :: *) = Eq a
type AlgebraType FreeGroupL (g :: *) Source # 
Instance details

Defined in Data.Group.Free

type AlgebraType FreeGroupL (g :: *) = (Eq g, Group g)

fromList :: Eq a => [Either a a] -> FreeGroupL a Source #

Smart constructors

normalizeL :: Eq a => [Either a a] -> [Either a a] Source #