free-algebras-0.0.7.1: Free algebras in Haskell.

Safe HaskellSafe
LanguageHaskell2010

Control.Algebra.Free2

Synopsis

Documentation

class FreeAlgebra2 (m :: (k -> k -> Type) -> k -> k -> Type) where Source #

Free algebra similar to FreeAlgebra1 and FreeAlgebra, but for types of kind Type -> Type -> Type. Examples include free categories, free arrows, etc (see 'free-category' package).

Methods

liftFree2 :: AlgebraType0 m f => f a b -> m f a b Source #

foldNatFree2 :: forall (d :: k -> k -> Type) (f :: k -> k -> Type) a b. (AlgebraType m d, AlgebraType0 m f) => (forall x y. f x y -> d x y) -> m f a b -> d a b Source #

codom2 :: forall (f :: k -> k -> Type). AlgebraType0 m f => Proof (AlgebraType m (m f)) (m f) Source #

forget2 :: forall (f :: k -> k -> Type). AlgebraType m f => Proof (AlgebraType0 m f) (m f) Source #

newtype Proof (c :: Constraint) (a :: l) Source #

A proof that constraint c holds for type a.

Constructors

Proof (Dict c) 

proof :: c => Proof (c :: Constraint) (a :: l) Source #

Proof smart constructor.

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
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 DList (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType0 DList (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 NonEmpty (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

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

Defined in Data.Algebra.Free

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

Defined in Data.Algebra.Free

type AlgebraType0 (Free Group) (a :: 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 FreeGroupL (a :: Type) Source # 
Instance details

Defined in Data.Group.Free

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

Defined in Data.Group.Free

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

Defined in Data.Semigroup.Abelian

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

Defined in Data.Monoid.Abelian

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

Defined in Data.Semigroup.SemiLattice

type AlgebraType0 MaybeT (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

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

Defined in Control.Algebra.Free

type AlgebraType0 F (f :: Type -> Type) = Functor f
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 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 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 Alt (f :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType0 Alt (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 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 (FreeMAction m :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) Source # 
Instance details

Defined in Control.Monad.Action

type AlgebraType0 (FreeMAction m :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) = Functor f
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 (StateT s :: (Type -> Type) -> Type -> Type) (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) (m :: Type -> Type) = Monad m
type AlgebraType0 (StateT s :: (Type -> Type) -> Type -> Type) (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) (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 (ReaderT r :: (k -> Type) -> k -> Type) (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 :: (k -> Type) -> k -> Type) (m :: Type -> Type) = Monad m
type AlgebraType0 (RWST r w s :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

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

Defined in Control.Algebra.Free

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

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
type AlgebraType Identity (a :: l) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType Identity (a :: l) = ()
type AlgebraType [] (m :: Type) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType [] (m :: Type) = Monoid m
type AlgebraType Maybe (m :: Type) Source # 
Instance details

Defined in Data.Algebra.Free

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

Defined in Data.Algebra.Free

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

Defined in Data.Algebra.Free

type AlgebraType DList (a :: Type) = Monoid a
type AlgebraType FreeGroupL (g :: Type) Source # 
Instance details

Defined in Data.Group.Free

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

Defined in Data.Group.Free

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

Defined in Data.Semigroup.Abelian

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

Defined in Data.Monoid.Abelian

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

Defined in Data.Semigroup.SemiLattice

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

Defined in Data.Algebra.Free

type AlgebraType (Free Monoid) (a :: Type) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType (Free Monoid) (a :: Type) = Monoid a
type AlgebraType (Free Group) (a :: Type) Source # 
Instance details

Defined in Data.Algebra.Free

type AlgebraType (Free Group) (a :: Type) = Group a
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 F (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

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

Defined in Control.Algebra.Free

type AlgebraType Free (m :: Type -> Type) = Monad 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 Alt (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType Alt (m :: Type -> Type) = Alternative 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 DayF (g :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

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

Defined in Control.Monad.Action

type AlgebraType (FreeMAction m :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) = MAction m f
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 (StateT s :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

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

Defined in Control.Algebra.Free

type AlgebraType (StateT s :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = MonadState s 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 (ReaderT r :: (k -> Type) -> k -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

type AlgebraType (ReaderT r :: (k -> Type) -> k -> Type) (m :: Type -> Type) = MonadReader r m
type AlgebraType (RWST r w s :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra.Free

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

Defined in Control.Algebra.Free

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

wrapFree2 :: forall (m :: (Type -> Type -> Type) -> Type -> Type -> Type) (f :: Type -> Type -> Type) a b. (AlgebraType0 m f, FreeAlgebra2 m, Monad (m f a)) => f a (m f a b) -> m f a b Source #

foldFree2 :: forall (m :: (k -> k -> Type) -> k -> k -> Type) (f :: k -> k -> Type) a b. (FreeAlgebra2 m, AlgebraType m f) => m f a b -> f a b Source #

unFoldNatFree2 :: forall (m :: (k -> k -> Type) -> k -> k -> Type) (f :: k -> k -> Type) d a b. (FreeAlgebra2 m, AlgebraType0 m f) => (forall x y. m f x y -> d x y) -> f a b -> d a b Source #

hoistFree2 :: forall (m :: (k -> k -> Type) -> k -> k -> Type) (f :: k -> k -> Type) g a b. (FreeAlgebra2 m, AlgebraType0 m g, AlgebraType0 m f) => (forall x y. f x y -> g x y) -> m f a b -> m g a b Source #

hoistFreeH2 :: forall m n f a b. (FreeAlgebra2 m, FreeAlgebra2 n, AlgebraType0 m f, AlgebraType0 n f, AlgebraType m (n f)) => m f a b -> n f a b Source #

joinFree2 :: forall (m :: (k -> k -> Type) -> k -> k -> Type) (f :: k -> k -> Type) a b. (FreeAlgebra2 m, AlgebraType0 m f) => m (m f) a b -> m f a b Source #

bindFree2 :: forall m f g a b. (FreeAlgebra2 m, AlgebraType0 m g, AlgebraType0 m f) => m f a b -> (forall x y. f x y -> m g x y) -> m g a b Source #

assocFree2 :: forall (m :: (Type -> Type -> Type) -> Type -> Type -> Type) (f :: Type -> Type -> Type) a b. (FreeAlgebra2 m, AlgebraType m f, Functor (m (m f) a)) => m f a (m f a b) -> m (m f) a (f a b) Source #