free-algebras-0.1.1.0: Free algebras
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Algebra.Free

Synopsis

Free algebra class

class FreeAlgebra (m :: Type -> Type) where Source #

A lawful instance has to guarantee that unFoldFree is an inverse of foldMapFree (in the category of algebras of type AlgebraType m).

This in turn guaranties that m is a left adjoint functor from full subcategory of Hask (of types constrained by AlgebraType0 m) to algebras of type AlgebraType m. The right adjoint is the forgetful functor. The composition of left adjoin and the right one is always a monad, this is why we will be able to build monad instance for m@.

Minimal complete definition

returnFree, foldMapFree

Methods

returnFree :: a -> m a Source #

Injective map that embeds generators a into m.

foldMapFree Source #

Arguments

:: forall d a. (AlgebraType m d, AlgebraType0 m a) 
=> (a -> d)

a mapping of generators of m into d

-> m a -> d

a homomorphism from m a to d

The freeness property.

codom :: forall a. AlgebraType0 m a => Proof (AlgebraType m (m a)) (m a) Source #

Proof that AlgebraType0 m a => m a is an algebra of type AlgebraType m. This proves that m is a mapping from the full subcategory of Hask of types satisfying AlgebraType0 m a constraint to the full subcategory satisfying AlgebraType m a, fmapFree below proves that it's a functor. (codom from codomain)

default codom :: forall a. AlgebraType m (m a) => Proof (AlgebraType m (m a)) (m a) Source #

forget :: forall a. AlgebraType m a => Proof (AlgebraType0 m a) (m a) Source #

Proof that the forgetful functor from types a satisfying AgelbraType m a to AlgebraType0 m a is well defined.

default forget :: forall a. AlgebraType0 m a => Proof (AlgebraType0 m a) (m a) Source #

Instances

Instances details
FreeAlgebra Identity Source # 
Instance details

Defined in Data.Algebra.Free

FreeAlgebra DList Source #

DList is isomorphic to Free Monoid; it is free in the class of all monoids.

Instance details

Defined in Data.Algebra.Free

FreeAlgebra DNonEmpty Source # 
Instance details

Defined in Data.Algebra.Free

FreeAlgebra FreeGroup Source # 
Instance details

Defined in Data.Group.Free

FreeAlgebra FreeGroupL Source # 
Instance details

Defined in Data.Group.Free

FreeAlgebra FreeAbelianMonoid Source # 
Instance details

Defined in Data.Monoid.Abelian

FreeAlgebra FreeAbelianSemigroup Source # 
Instance details

Defined in Data.Semigroup.Abelian

FreeAlgebra FreeSemilattice Source # 
Instance details

Defined in Data.Semigroup.Semilattice

FreeAlgebra NonEmpty Source #

NonEmpty is the free semigroup in the class of semigroup which are strict in the left argument.

Instance details

Defined in Data.Algebra.Free

FreeAlgebra Maybe Source # 
Instance details

Defined in Data.Algebra.Free

FreeAlgebra [] Source #

Note that '[]' is a free monoid only for monoids which multiplication is strict in the left argument ref. Note that being strict adds additional equation to the monoid laws:

undefined <> a = undefined

Thus, expectedly we get an equational theory for left right two-sided strict monoids.

Snoc lists are free monoids in the class of monoids which are strict in the right argument, Free Monoid and @DList are free in the class of all Haskell monoids.

Instance details

Defined in Data.Algebra.Free

Methods

returnFree :: a -> [a] Source #

foldMapFree :: (AlgebraType [] d, AlgebraType0 [] a) => (a -> d) -> [a] -> d Source #

codom :: AlgebraType0 [] a => Proof (AlgebraType [] [a]) [a] Source #

forget :: AlgebraType [] a => Proof (AlgebraType0 [] a) [a] Source #

FreeAlgebra (Free Monoid) Source # 
Instance details

Defined in Data.Algebra.Free

FreeAlgebra (Free Semigroup) Source # 
Instance details

Defined in Data.Algebra.Free

FreeAlgebra (Free Group) Source # 
Instance details

Defined in Data.Algebra.Free

Type level witnesses

data Proof (c :: Constraint) (a :: l) where Source #

A proof that constraint c holds for type a.

Constructors

Proof :: c => Proof c a 

Algebra types / constraints

type family AlgebraType (f :: k) (a :: l) :: Constraint Source #

Type family which for each free algebra m returns a type level lambda from types to constraints. It is describe the class of algebras for which this free algebra is free.

A lawful instance for this type family must guarantee that the constraint AlgebraType0 m f is implied by the AlgebraType m f constraint. This guarantees that there exists a forgetful functor from the category of types of kind * -> * which satisfy AlgebraType m constrain to the category of types of kind * -> * which satisfy the 'AlgebraType0 m constraint.

Instances

Instances details
type AlgebraType FreeGroup (g :: Type) Source # 
Instance details

Defined in Data.Group.Free

type AlgebraType FreeGroup (g :: Type) = (Eq g, Group g)
type AlgebraType FreeGroupL (g :: Type) Source # 
Instance details

Defined in Data.Group.Free

type AlgebraType FreeGroupL (g :: Type) = (Eq g, Group g)
type AlgebraType FreeAbelianMonoid (m :: Type) Source # 
Instance details

Defined in Data.Monoid.Abelian

type AlgebraType FreeAbelianSemigroup (a :: Type) Source # 
Instance details

Defined in Data.Semigroup.Abelian

type AlgebraType FreeSemilattice (a :: Type) Source # 
Instance details

Defined in Data.Semigroup.Semilattice

type AlgebraType Maybe (m :: Type) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType Maybe (m :: Type) = Pointed m
type AlgebraType Identity (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType Identity (a :: l) = ()
type AlgebraType DList (a :: TYPE LiftedRep) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType DNonEmpty (m :: TYPE LiftedRep) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType NonEmpty (m :: TYPE LiftedRep) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType [] (m :: TYPE LiftedRep) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType [] (m :: TYPE LiftedRep) = Monoid m
type AlgebraType (Free Monoid) (a :: TYPE LiftedRep) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType (Free Semigroup) (a :: TYPE LiftedRep) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType (Free Group) (a :: TYPE LiftedRep) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType Alt (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType Alt (m :: Type -> Type) = Alternative m
type AlgebraType Ap (g :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType Ap (g :: Type -> Type) = Applicative g
type AlgebraType Ap (g :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType Ap (g :: Type -> Type) = Applicative g
type AlgebraType Ap (g :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType Ap (g :: Type -> Type) = Applicative g
type AlgebraType F (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType F (m :: Type -> Type) = Monad m
type AlgebraType DayF (g :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType DayF (g :: Type -> Type) = Applicative g
type AlgebraType Free (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType Free (m :: Type -> Type) = Monad m
type AlgebraType Coyoneda (g :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType Coyoneda (g :: Type -> Type) = Functor g
type AlgebraType ListT (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType ListT (m :: Type -> Type) = MonadList m
type AlgebraType MaybeT (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType MaybeT (m :: Type -> Type) = (Monad m, MonadMaybe m)
type AlgebraType (Free1 c :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType (Free1 c :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) = c f
type AlgebraType (FreeMAction m :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # 
Instance details

Defined in Control.Monad.Action

type AlgebraType (FreeMAction m :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) = MAction m f
type AlgebraType (ReaderT r :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType (ReaderT r :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) = MonadReader r m
type AlgebraType (StateT s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType (StateT s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) = MonadState s m
type AlgebraType (StateT s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType (StateT s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) = MonadState s m
type AlgebraType (ExceptT e :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType (ExceptT e :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = MonadError e m
type AlgebraType (WriterT w :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType (WriterT w :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = MonadWriter w m
type AlgebraType (WriterT w :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType (WriterT w :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = MonadWriter w m
type AlgebraType (RWST r w s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType (RWST r w s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) = MonadRWS r w s m
type AlgebraType (RWST r w s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType (RWST r w s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) = MonadRWS r w s m

type family AlgebraType0 (f :: k) (a :: l) :: Constraint Source #

Type family which limits Hask to its full subcategory which satisfies a given constraints. Some free algebras, like free groups, or free abelian semigroups have additional constraints on on generators, like Eq or Ord.

Instances

Instances details
type AlgebraType0 Coyoneda (g :: l) Source #

Algebras of the same type as Coyoneda are all functors.

Instance details

Defined in Control.Algebra.Free

type AlgebraType0 Coyoneda (g :: l) = ()
type AlgebraType0 FreeGroup (a :: Type) Source # 
Instance details

Defined in Data.Group.Free

type AlgebraType0 FreeGroup (a :: Type) = Eq a
type AlgebraType0 FreeGroupL (a :: Type) Source # 
Instance details

Defined in Data.Group.Free

type AlgebraType0 FreeGroupL (a :: Type) = Eq a
type AlgebraType0 FreeAbelianMonoid (a :: Type) Source # 
Instance details

Defined in Data.Monoid.Abelian

type AlgebraType0 FreeAbelianSemigroup (a :: Type) Source # 
Instance details

Defined in Data.Semigroup.Abelian

type AlgebraType0 FreeSemilattice (a :: Type) Source # 
Instance details

Defined in Data.Semigroup.Semilattice

type AlgebraType0 DList (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 DList (a :: l) = ()
type AlgebraType0 DNonEmpty (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 DNonEmpty (a :: l) = ()
type AlgebraType0 Identity (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 Identity (a :: l) = ()
type AlgebraType0 NonEmpty (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 NonEmpty (a :: l) = ()
type AlgebraType0 Maybe (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 Maybe (a :: l) = ()
type AlgebraType0 [] (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 [] (a :: l) = ()
type AlgebraType0 (Free1 c :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: l) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType0 (Free1 c :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: l) = ()
type AlgebraType0 (Free Monoid) (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 (Free Monoid) (a :: l) = ()
type AlgebraType0 (Free Semigroup) (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 (Free Semigroup) (a :: l) = ()
type AlgebraType0 (Free Group) (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 (Free Group) (a :: l) = ()
type AlgebraType0 Alt (f :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType0 Alt (f :: Type -> Type) = Functor f
type AlgebraType0 Ap (g :: Type -> Type) Source #

Algebras of the same type as Ap are the applicative functors.

Instance details

Defined in Control.Algebra.Free

type AlgebraType0 Ap (g :: Type -> Type) = Functor g
type AlgebraType0 Ap (g :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType0 Ap (g :: Type -> Type) = Functor g
type AlgebraType0 Ap (g :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType0 Ap (g :: Type -> Type) = Functor g
type AlgebraType0 F (f :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType0 F (f :: Type -> Type) = Functor f
type AlgebraType0 DayF (g :: Type -> Type) Source #

Algebras of the same type as DayF are all the applicative functors.

Instance details

Defined in Control.Algebra.Free

type AlgebraType0 Free (f :: Type -> Type) Source #

Algebras of the same type as Free monad is the class of all monads.

Instance details

Defined in Control.Algebra.Free

type AlgebraType0 Free (f :: Type -> Type) = Functor f
type AlgebraType0 ListT (f :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType0 ListT (f :: Type -> Type) = Monad f
type AlgebraType0 MaybeT (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType0 MaybeT (m :: Type -> Type) = Monad m
type AlgebraType0 (FreeMAction m :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) Source # 
Instance details

Defined in Control.Monad.Action

type AlgebraType0 (FreeMAction m :: (Type -> Type) -> Type -> TYPE LiftedRep) (f :: Type -> Type) = Functor f
type AlgebraType0 (ReaderT r :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) Source #

Algebras of the same type as ReaderT monad is the class of all reader monads.

TODO: take advantage of poly-kinded ReaderT

Instance details

Defined in Control.Algebra.Free

type AlgebraType0 (ReaderT r :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) = Monad m
type AlgebraType0 (StateT s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) Source #

Algebras of the same type as StateT monad is the class of all state monads.

Instance details

Defined in Control.Algebra.Free

type AlgebraType0 (StateT s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) = Monad m
type AlgebraType0 (StateT s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) Source #

Algebras of the same type as StateT monad is the class of all state monads.

Instance details

Defined in Control.Algebra.Free

type AlgebraType0 (StateT s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) = Monad m
type AlgebraType0 (ExceptT e :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source #

Algebras of the same type as ReaderT monad is the class of all reader monads.

Instance details

Defined in Control.Algebra.Free

type AlgebraType0 (ExceptT e :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = Monad m
type AlgebraType0 (WriterT w :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source #

Algebras of the same type as WriterT monad is the class of all writer monads.

Instance details

Defined in Control.Algebra.Free

type AlgebraType0 (WriterT w :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = (Monad m, Monoid w)
type AlgebraType0 (WriterT w :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source #

Algebras of the same type as WriterT monad is the class of all writer monads.

Instance details

Defined in Control.Algebra.Free

type AlgebraType0 (WriterT w :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = (Monad m, Monoid w)
type AlgebraType0 (RWST r w s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType0 (RWST r w s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) = (Monad m, Monoid w)
type AlgebraType0 (RWST r w s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType0 (RWST r w s :: (Type -> Type) -> Type -> TYPE LiftedRep) (m :: Type -> Type) = (Monad m, Monoid w)

Combinators

unFoldMapFree :: FreeAlgebra m => (m a -> d) -> a -> d Source #

Inverse of foldMapFree

It is uniquely determined by its universal property (by Yoneda lemma):

unFoldMapFree id = returnFree

Note that unFoldMapFree id is the unit of the unit of the adjunction imposed by the FreeAlgebra constraint.

foldFree :: forall m a. (FreeAlgebra m, AlgebraType m a) => m a -> a Source #

All types which satisfy FreeAlgebra constraint are foldable.

foldFree . returnFree == id

foldFree is the unit of the adjunction imposed by FreeAlgebra constraint.

Examples:

foldFree @[] = foldMap id
             = foldr (<>) mempty
foldFree @NonEmpty
             = foldr1 (<>)

Note that foldFree replaces the abstract / free algebraic operation in m a to concrete one in a.

natFree :: forall m n a. (FreeAlgebra m, FreeAlgebra n, AlgebraType0 m a, AlgebraType m (n a)) => m a -> n a Source #

The canonical quotient map from a free algebra of a wider class to a free algebra of a narrower class, e.g. from a free semigroup to free monoid, or from a free monoid to free commutative monoid, etc.

natFree . natFree == natFree
fmapFree f . natFree == hoistFree . fmapFree f

the constraints: * the algebra n a is of the same type as algebra m (this is always true, just GHC cannot prove it here) * m is a free algebra generated by a * n is a free algebra generated by a

fmapFree :: forall m a b. (FreeAlgebra m, AlgebraType0 m a, AlgebraType0 m b) => (a -> b) -> m a -> m b Source #

All types which satisfy FreeAlgebra constraint are functors. The constraint AlgebraType m (m b) is always satisfied.

joinFree :: forall m a. (FreeAlgebra m, AlgebraType0 m a) => m (m a) -> m a Source #

FreeAlgebra constraint implies Monad constrain.

bindFree :: forall m a b. (FreeAlgebra m, AlgebraType0 m a, AlgebraType0 m b) => m a -> (a -> m b) -> m b Source #

The monadic bind operator. returnFree is the corresponding return for this monad. This just foldMapFree in disguise.

cataFree :: (FreeAlgebra m, AlgebraType m a, Functor m) => Fix m -> a Source #

Fix m is the initial algebra in the category of algebras of type AlgebraType m (the initial algebra is a free algebra generated by empty set of generators, e.g. the Void type).

Another way of putting this is observing that Fix m is isomorphic to m Void where m is the free algebra. This isomorphisms is given by fixToFree :: (FreeAlgebra m, AlgebraType m (m Void), Functor m) => Fix m -> m Void fixToFree = cataFree For monoids the inverse is given by ana (_ -> []).

foldrFree :: forall m a b. (FreeAlgebra m, AlgebraType m (Endo b), AlgebraType0 m a) => (a -> b -> b) -> b -> m a -> b Source #

A version of foldr, e.g. it can specialize to

  • foldrFree @[] :: (a -> b -> b) -> [a] -> b -> b
  • foldrFree @NonEmpty :: (a -> b -> b) -> NonEmpty a -> b -> b

foldrFree' :: forall m a b. (FreeAlgebra m, AlgebraType m (Dual (Endo (b -> b))), AlgebraType0 m a) => (a -> b -> b) -> m a -> b -> b Source #

Like foldrFree but strict.

foldlFree :: forall m a b. (FreeAlgebra m, AlgebraType m (Dual (Endo b)), AlgebraType0 m a) => (b -> a -> b) -> b -> m a -> b Source #

Generalizes foldl, e.g. it can specialize to

  • foldlFree @[] :: (b -> a -> b) -> b -> [a] -> b
  • foldlFree @NonEmpty :: (b -> a -> b) -> b -> NonEmpty a -> b

foldlFree' :: forall m a b. (FreeAlgebra m, AlgebraType m (Endo (b -> b)), AlgebraType0 m a) => (b -> a -> b) -> b -> m a -> b Source #

Like foldlFree but strict.

General free type

newtype Free (c :: Type -> Constraint) a Source #

Free c a represents free algebra for a constraint c generated by type a.

Constructors

Free 

Fields

  • runFree :: forall r. c r => (a -> r) -> r
     

Instances

Instances details
FreeAlgebra (Free Monoid) Source # 
Instance details

Defined in Data.Algebra.Free

FreeAlgebra (Free Semigroup) Source # 
Instance details

Defined in Data.Algebra.Free

FreeAlgebra (Free Group) Source # 
Instance details

Defined in Data.Algebra.Free

Monoid (Free Monoid a) Source # 
Instance details

Defined in Data.Algebra.Free

Monoid (Free Group a) Source # 
Instance details

Defined in Data.Algebra.Free

Methods

mempty :: Free Group a #

mappend :: Free Group a -> Free Group a -> Free Group a #

mconcat :: [Free Group a] -> Free Group a #

Semigroup (Free Monoid a) Source # 
Instance details

Defined in Data.Algebra.Free

Methods

(<>) :: Free Monoid a -> Free Monoid a -> Free Monoid a #

sconcat :: NonEmpty (Free Monoid a) -> Free Monoid a #

stimes :: Integral b => b -> Free Monoid a -> Free Monoid a #

Semigroup (Free Semigroup a) Source # 
Instance details

Defined in Data.Algebra.Free

Semigroup (Free Group a) Source # 
Instance details

Defined in Data.Algebra.Free

Methods

(<>) :: Free Group a -> Free Group a -> Free Group a #

sconcat :: NonEmpty (Free Group a) -> Free Group a #

stimes :: Integral b => b -> Free Group a -> Free Group a #

Group (Free Group a) Source # 
Instance details

Defined in Data.Algebra.Free

Methods

invert :: Free Group a -> Free Group a #

(~~) :: Free Group a -> Free Group a -> Free Group a #

pow :: Integral x => Free Group a -> x -> Free Group a #

type AlgebraType0 (Free Monoid) (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 (Free Monoid) (a :: l) = ()
type AlgebraType0 (Free Semigroup) (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 (Free Semigroup) (a :: l) = ()
type AlgebraType0 (Free Group) (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 (Free Group) (a :: l) = ()
type AlgebraType (Free Monoid) (a :: TYPE LiftedRep) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType (Free Semigroup) (a :: TYPE LiftedRep) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType (Free Group) (a :: TYPE LiftedRep) Source # 
Instance details

Defined in Data.Algebra.Free

newtype DNonEmpty a Source #

DNonEmpty is the free semigroup in the class of all semigroups.

Constructors

DNonEmpty ([a] -> NonEmpty a) 

Instances

Instances details
FreeAlgebra DNonEmpty Source # 
Instance details

Defined in Data.Algebra.Free

Semigroup (DNonEmpty a) Source # 
Instance details

Defined in Data.Algebra.Free

Methods

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

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

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

type AlgebraType0 DNonEmpty (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 DNonEmpty (a :: l) = ()
type AlgebraType DNonEmpty (m :: TYPE LiftedRep) Source # 
Instance details

Defined in Data.Algebra.Free