Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | sjoerd@w3future.com |
Safe Haskell | Safe-Inferred |
- class (Functor f, Dom f ~ (Cod f :**: Cod f)) => TensorProduct f where
- type Unit f :: *
- unitObject :: f -> Obj (Cod f) (Unit f)
- leftUnitor :: Cod f ~ k => f -> Obj k a -> k (f :% (Unit f, a)) a
- leftUnitorInv :: Cod f ~ k => f -> Obj k a -> k a (f :% (Unit f, a))
- rightUnitor :: Cod f ~ k => f -> Obj k a -> k (f :% (a, Unit f)) a
- rightUnitorInv :: Cod f ~ k => f -> Obj k a -> k a (f :% (a, Unit f))
- 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)))
- 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))
- data MonoidObject f a = MonoidObject {}
- data ComonoidObject f a = ComonoidObject {}
- data MonoidAsCategory f m a b where
- MonoidValue :: (TensorProduct f, Dom f ~ (k :**: k), Cod f ~ k) => f -> MonoidObject f m -> k (Unit f) m -> MonoidAsCategory f m m m
- type Monad f = MonoidObject (FunctorCompose (Dom f)) f
- 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 f
- monadFunctor :: Monad f -> f
- type Comonad f = ComonoidObject (FunctorCompose (Dom f)) f
- 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 f
- adjunctionMonad :: Adjunction c d f g -> Monad (g :.: f)
- adjunctionComonad :: Adjunction c d f g -> Comonad (f :.: g)
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.
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
TensorProduct Add | Ordinal addition makes the simplex category a monoidal category, with |
Category k => TensorProduct (FunctorCompose 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
.
data ComonoidObject f a Source
ComonoidObject f a
defines a comonoid a
in a comonoidal category with tensor product f
.
data MonoidAsCategory f m a b whereSource
MonoidValue :: (TensorProduct f, Dom f ~ (k :**: k), Cod f ~ k) => f -> MonoidObject f m -> k (Unit f) m -> MonoidAsCategory f m m m |
Category (MonoidAsCategory f m) | A monoid as a category with one object. |
type Monad f = MonoidObject (FunctorCompose (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
monadFunctor :: Monad f -> fSource
type Comonad f = ComonoidObject (FunctorCompose (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.