data-category-0.6.1: Category theory

Portabilitynon-portable
Stabilityexperimental
Maintainersjoerd@w3future.com
Safe HaskellSafe-Inferred

Data.Category.Monoidal

Description

 

Synopsis

Documentation

class (Functor f, Dom f ~ (Cod f :**: Cod f)) => TensorProduct f whereSource

A monoidal category is a category with some kind of tensor product. A tensor product is a bifunctor, with a unit object.

Associated Types

type Unit f :: *Source

Methods

unitObject :: f -> Obj (Cod f) (Unit f)Source

leftUnitor :: Cod f ~ k => f -> Obj k a -> k (f :% (Unit f, a)) aSource

leftUnitorInv :: Cod f ~ k => f -> Obj k a -> k a (f :% (Unit f, a))Source

rightUnitor :: Cod f ~ k => f -> Obj k a -> k (f :% (a, Unit f)) aSource

rightUnitorInv :: Cod f ~ k => f -> Obj k a -> k a (f :% (a, Unit f))Source

associator :: Cod f ~ k => f -> Obj k a -> Obj k b -> Obj k c -> k (f :% (f :% (a, b), c)) (f :% (a, f :% (b, c)))Source

associatorInv :: Cod f ~ k => f -> Obj k a -> Obj k b -> Obj k c -> k (f :% (a, f :% (b, c))) (f :% (f :% (a, b), c))Source

Instances

TensorProduct Add

Ordinal addition makes the simplex category a monoidal category, with 0 as unit.

TensorProduct Add 
Category k => TensorProduct (EndoFunctorCompose k)

Functor composition makes the category of endofunctors monoidal, with the identity functor as unit.

(HasInitialObject k, HasBinaryCoproducts k) => TensorProduct (CoproductFunctor k)

If a category has all coproducts, then the coproduct functor makes it a monoidal category, with the initial object as unit.

(HasTerminalObject k, HasBinaryProducts k) => TensorProduct (ProductFunctor k)

If a category has all products, then the product functor makes it a monoidal category, with the terminal object as unit.

data MonoidObject f a Source

MonoidObject f a defines a monoid a in a monoidal category with tensor product f.

Constructors

MonoidObject 

Fields

unit :: Cod f ~ k => k (Unit f) a
 
multiply :: Cod f ~ k => k (f :% (a, a)) a
 

data ComonoidObject f a Source

ComonoidObject f a defines a comonoid a in a comonoidal category with tensor product f.

Constructors

ComonoidObject 

Fields

counit :: Cod f ~ k => k a (Unit f)
 
comultiply :: Cod f ~ k => k a (f :% (a, a))
 

data MonoidAsCategory f m a b whereSource

Constructors

MonoidValue :: (TensorProduct f, Dom f ~ (k :**: k), Cod f ~ k) => f -> MonoidObject f m -> k (Unit f) m -> MonoidAsCategory f m m m 

Instances

Category (MonoidAsCategory f m)

A monoid as a category with one object.

type Monad f = MonoidObject (EndoFunctorCompose (Dom f)) fSource

A monad is a monoid in the category of endofunctors.

mkMonad :: (Functor f, Dom f ~ k, Cod f ~ k, Category k) => f -> (forall a. Obj k a -> Component (Id k) f a) -> (forall a. Obj k a -> Component (f :.: f) f a) -> Monad fSource

type Comonad f = ComonoidObject (EndoFunctorCompose (Dom f)) fSource

A comonad is a comonoid in the category of endofunctors.

mkComonad :: (Functor f, Dom f ~ k, Cod f ~ k, Category k) => f -> (forall a. Obj k a -> Component f (Id k) a) -> (forall a. Obj k a -> Component f (f :.: f) a) -> Comonad fSource

adjunctionMonad :: Adjunction c d f g -> Monad (g :.: f)Source

Every adjunction gives rise to an associated monad.

adjunctionComonad :: Adjunction c d f g -> Comonad (f :.: g)Source

Every adjunction gives rise to an associated comonad.