data-category-0.11: Category theory
LicenseBSD-style (see the file LICENSE)
Maintainersjoerd@w3future.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
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 :: Kind (Cod 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

Instances details
TensorProduct Add Source # 
Instance details

Defined in Data.Category.Cube

Associated Types

type Unit Add :: Kind (Cod f) 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 LinearTensor Source # 
Instance details

Defined in Data.Category.Monoidal

Associated Types

type Unit LinearTensor :: Kind (Cod f) Source #

TensorProduct Add Source #

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

Instance details

Defined in Data.Category.Simplex

Associated Types

type Unit Add :: Kind (Cod f) 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 #

(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.

Instance details

Defined in Data.Category.Monoidal

Associated Types

type Unit (CoproductFunctor k) :: Kind (Cod f) 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.

Instance details

Defined in Data.Category.Monoidal

Associated Types

type Unit (ProductFunctor k) :: Kind (Cod f) Source #

Methods

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

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

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

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

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

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

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

TensorProduct t => TensorProduct (Day t) Source # 
Instance details

Defined in Data.Category.Monoidal

Associated Types

type Unit (Day t) :: Kind (Cod f) Source #

Methods

unitObject :: Day t -> Obj (Cod (Day t)) (Unit (Day t)) Source #

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

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

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

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

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

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

Category k => TensorProduct (EndoFunctorCompose k) Source #

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

Instance details

Defined in Data.Category.Monoidal

Associated Types

type Unit (EndoFunctorCompose k) :: Kind (Cod f) Source #

(TensorProduct t, Cod t ~ f (Fix f)) => TensorProduct (WrapTensor (Fix f) t) Source #

Fix f inherits tensor products from f (Fix f).

Instance details

Defined in Data.Category.Fix

Associated Types

type Unit (WrapTensor (Fix f) t) :: Kind (Cod f) Source #

Methods

unitObject :: WrapTensor (Fix f) t -> Obj (Cod (WrapTensor (Fix f) t)) (Unit (WrapTensor (Fix f) t)) Source #

leftUnitor :: Cod (WrapTensor (Fix f) t) ~ k => WrapTensor (Fix f) t -> Obj k a -> k (WrapTensor (Fix f) t :% (Unit (WrapTensor (Fix f) t), a)) a Source #

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

rightUnitor :: Cod (WrapTensor (Fix f) t) ~ k => WrapTensor (Fix f) t -> Obj k a -> k (WrapTensor (Fix f) t :% (a, Unit (WrapTensor (Fix f) t))) a Source #

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

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

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

class TensorProduct f => SymmetricTensorProduct f where Source #

Methods

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

Instances

Instances details
SymmetricTensorProduct LinearTensor Source # 
Instance details

Defined in Data.Category.Monoidal

Methods

swap :: Cod LinearTensor ~ k => LinearTensor -> Obj k a -> Obj k b -> k (LinearTensor :% (a, b)) (LinearTensor :% (b, a)) Source #

(HasInitialObject k, HasBinaryCoproducts k) => SymmetricTensorProduct (CoproductFunctor k) Source # 
Instance details

Defined in Data.Category.Monoidal

Methods

swap :: Cod (CoproductFunctor k) ~ k0 => CoproductFunctor k -> Obj k0 a -> Obj k0 b -> k0 (CoproductFunctor k :% (a, b)) (CoproductFunctor k :% (b, a)) Source #

(HasTerminalObject k, HasBinaryProducts k) => SymmetricTensorProduct (ProductFunctor k) Source # 
Instance details

Defined in Data.Category.Monoidal

Methods

swap :: Cod (ProductFunctor k) ~ k0 => ProductFunctor k -> Obj k0 a -> Obj k0 b -> k0 (ProductFunctor k :% (a, b)) (ProductFunctor k :% (b, a)) Source #

data LinearTensor Source #

Constructors

LinearTensor 

Instances

Instances details
Functor LinearTensor Source # 
Instance details

Defined in Data.Category.Monoidal

Associated Types

type Dom LinearTensor :: Type -> Type -> Type Source #

type Cod LinearTensor :: Type -> Type -> Type Source #

type LinearTensor :% a Source #

SymmetricTensorProduct LinearTensor Source # 
Instance details

Defined in Data.Category.Monoidal

Methods

swap :: Cod LinearTensor ~ k => LinearTensor -> Obj k a -> Obj k b -> k (LinearTensor :% (a, b)) (LinearTensor :% (b, a)) Source #

TensorProduct LinearTensor Source # 
Instance details

Defined in Data.Category.Monoidal

Associated Types

type Unit LinearTensor :: Kind (Cod f) Source #

type Cod LinearTensor Source # 
Instance details

Defined in Data.Category.Monoidal

type Dom LinearTensor Source # 
Instance details

Defined in Data.Category.Monoidal

type Unit LinearTensor Source # 
Instance details

Defined in Data.Category.Monoidal

type Unit LinearTensor = ()
type LinearTensor :% (a, b) Source # 
Instance details

Defined in Data.Category.Monoidal

type LinearTensor :% (a, b) = (a, b)

data Day t Source #

Day convolution

Constructors

Day t 

Instances

Instances details
TensorProduct t => Functor (Day t) Source # 
Instance details

Defined in Data.Category.Monoidal

Associated Types

type Dom (Day t) :: Type -> Type -> Type Source #

type Cod (Day t) :: Type -> Type -> Type Source #

type (Day t) :% a Source #

Methods

(%) :: Day t -> Dom (Day t) a b -> Cod (Day t) (Day t :% a) (Day t :% b) Source #

TensorProduct t => TensorProduct (Day t) Source # 
Instance details

Defined in Data.Category.Monoidal

Associated Types

type Unit (Day t) :: Kind (Cod f) Source #

Methods

unitObject :: Day t -> Obj (Cod (Day t)) (Unit (Day t)) Source #

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

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

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

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

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

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

type Cod (Day t) Source # 
Instance details

Defined in Data.Category.Monoidal

type Cod (Day t) = Nat (Cod t) (->)
type Dom (Day t) Source # 
Instance details

Defined in Data.Category.Monoidal

type Dom (Day t) = Nat (Cod t) (->) :**: Nat (Cod t) (->)
type Unit (Day t) Source # 
Instance details

Defined in Data.Category.Monoidal

type Unit (Day t) = Curry1 (Op (Cod t)) (Cod t) (Hom (Cod t)) :% Unit t
type (Day t) :% (f, g) Source # 
Instance details

Defined in Data.Category.Monoidal

type (Day t) :% (f, g) = LanHaskF t (ProductFunctor (->) :.: (f :***: g))

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

Instances details
Category (MonoidAsCategory f m :: Type -> Type -> Type) Source #

A monoid as a category with one object.

Instance details

Defined in Data.Category.Monoidal

Methods

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

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

(.) :: forall (b :: k) (c :: k) (a :: k). 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.