data-category-0.7: Category theory

LicenseBSD-style (see the file LICENSE)
Maintainersjoerd@w3future.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell2010

Data.Category.Monoidal

Description

 

Synopsis

Documentation

class (Functor f, Dom f ~ (Cod f :**: Cod f)) => TensorProduct f where Source #

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)) a Source #

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)) a Source #

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 Source # 

Associated Types

type Unit Add :: * Source #

Methods

unitObject :: Add -> Obj (Cod Add) (Unit Add) Source #

leftUnitor :: ((* -> * -> *) ~ Cod Add) k => Add -> Obj k a -> k (Add :% (Unit Add, a)) a Source #

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

rightUnitor :: ((* -> * -> *) ~ Cod Add) k => Add -> Obj k a -> k (Add :% (a, Unit Add)) a Source #

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

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

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

TensorProduct Add Source #

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

Associated Types

type Unit Add :: * Source #

Methods

unitObject :: Add -> Obj (Cod Add) (Unit Add) Source #

leftUnitor :: ((* -> * -> *) ~ Cod Add) k => Add -> Obj k a -> k (Add :% (Unit Add, a)) a Source #

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

rightUnitor :: ((* -> * -> *) ~ Cod Add) k => Add -> Obj k a -> k (Add :% (a, Unit Add)) a Source #

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

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

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

Category k => TensorProduct (EndoFunctorCompose k) Source #

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

Associated Types

type Unit (EndoFunctorCompose k) :: * Source #

Methods

unitObject :: EndoFunctorCompose k -> Obj (Cod (EndoFunctorCompose k)) (Unit (EndoFunctorCompose k)) Source #

leftUnitor :: ((* -> * -> *) ~ Cod (EndoFunctorCompose k)) k => EndoFunctorCompose k -> Obj k a -> k (EndoFunctorCompose k :% (Unit (EndoFunctorCompose k), a)) a Source #

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

rightUnitor :: ((* -> * -> *) ~ Cod (EndoFunctorCompose k)) k => EndoFunctorCompose k -> Obj k a -> k (EndoFunctorCompose k :% (a, Unit (EndoFunctorCompose k))) a Source #

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

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

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

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

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

Associated Types

type Unit (CoproductFunctor k) :: * Source #

Methods

unitObject :: CoproductFunctor k -> Obj (Cod (CoproductFunctor k)) (Unit (CoproductFunctor k)) Source #

leftUnitor :: ((* -> * -> *) ~ Cod (CoproductFunctor k)) k => CoproductFunctor k -> Obj k a -> k (CoproductFunctor k :% (Unit (CoproductFunctor k), a)) a Source #

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

rightUnitor :: ((* -> * -> *) ~ Cod (CoproductFunctor k)) k => CoproductFunctor k -> Obj k a -> k (CoproductFunctor k :% (a, Unit (CoproductFunctor k))) a Source #

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

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

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

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

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

Associated Types

type Unit (ProductFunctor k) :: * Source #

Methods

unitObject :: ProductFunctor k -> Obj (Cod (ProductFunctor k)) (Unit (ProductFunctor k)) Source #

leftUnitor :: ((* -> * -> *) ~ Cod (ProductFunctor k)) k => ProductFunctor k -> Obj k a -> k (ProductFunctor k :% (Unit (ProductFunctor k), a)) a Source #

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

rightUnitor :: ((* -> * -> *) ~ Cod (ProductFunctor k)) k => ProductFunctor k -> Obj k a -> k (ProductFunctor k :% (a, Unit (ProductFunctor k))) a Source #

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

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

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

data MonoidObject f a Source #

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

Constructors

MonoidObject 

Fields

data ComonoidObject f a Source #

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

Constructors

ComonoidObject 

Fields

data MonoidAsCategory f m a b where Source #

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) Source #

A monoid as a category with one object.

Methods

src :: MonoidAsCategory f m a b -> Obj (MonoidAsCategory f m) a Source #

tgt :: MonoidAsCategory f m a b -> Obj (MonoidAsCategory f m) b Source #

(.) :: MonoidAsCategory f m b c -> MonoidAsCategory f m a b -> MonoidAsCategory f m a c Source #

type Monad f = MonoidObject (EndoFunctorCompose (Dom f)) f Source #

A monad is a monoid in the category of endofunctors.

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

type Comonad f = ComonoidObject (EndoFunctorCompose (Dom f)) f Source #

A comonad is a comonoid in the category of endofunctors.

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

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

Every adjunction gives rise to an associated monad.

adjunctionMonadT :: Dom m ~ c => Adjunction c d f g -> Monad m -> Monad ((g :.: m) :.: f) Source #

Every adjunction gives rise to an associated monad transformer.

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

Every adjunction gives rise to an associated comonad.

adjunctionComonadT :: Dom w ~ d => Adjunction c d f g -> Comonad w -> Comonad ((f :.: w) :.: g) Source #

Every adjunction gives rise to an associated comonad transformer.