License | BSD-style (see the file LICENSE) |
---|---|
Maintainer | sjoerd@w3future.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- 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))
- class TensorProduct f => SymmetricTensorProduct f where
- data MonoidObject f a = MonoidObject {}
- trivialMonoid :: TensorProduct f => f -> MonoidObject f (Unit f)
- coproductMonoid :: (HasInitialObject k, HasBinaryCoproducts k) => Obj k a -> MonoidObject (CoproductFunctor k) a
- data ComonoidObject f a = ComonoidObject {}
- trivialComonoid :: TensorProduct f => f -> ComonoidObject f (Unit f)
- productComonoid :: (HasTerminalObject k, HasBinaryProducts k) => Obj k a -> ComonoidObject (ProductFunctor k) a
- 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 (EndoFunctorCompose (Dom f)) f
- 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
- monadFunctor :: Monad f -> f
- idMonad :: Category k => Monad (Id k)
- type Comonad f = ComonoidObject (EndoFunctorCompose (Dom f)) f
- 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
- idComonad :: Category k => Comonad (Id k)
- adjunctionMonad :: Adjunction c d f g -> Monad (g :.: f)
- adjunctionMonadT :: Dom m ~ c => Adjunction c d f g -> Monad m -> Monad ((g :.: m) :.: f)
- adjunctionComonad :: Adjunction c d f g -> Comonad (f :.: g)
- adjunctionComonadT :: Dom w ~ d => Adjunction c d f g -> Comonad w -> Comonad ((f :.: w) :.: g)
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.
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
class TensorProduct f => SymmetricTensorProduct f where Source #
Instances
(HasInitialObject k, HasBinaryCoproducts k) => SymmetricTensorProduct (CoproductFunctor k) Source # | |
Defined in Data.Category.Monoidal 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 # | |
Defined in Data.Category.Monoidal swap :: Cod (ProductFunctor k) ~ k0 => ProductFunctor k -> Obj k0 a -> Obj k0 b -> k0 (ProductFunctor k :% (a, b)) (ProductFunctor k :% (b, a)) Source # |
data MonoidObject f a Source #
MonoidObject f a
defines a monoid a
in a monoidal category with tensor product f
.
trivialMonoid :: TensorProduct f => f -> MonoidObject f (Unit f) Source #
coproductMonoid :: (HasInitialObject k, HasBinaryCoproducts k) => Obj k a -> MonoidObject (CoproductFunctor k) a Source #
data ComonoidObject f a Source #
ComonoidObject f a
defines a comonoid a
in a comonoidal category with tensor product f
.
trivialComonoid :: TensorProduct f => f -> ComonoidObject f (Unit f) Source #
productComonoid :: (HasTerminalObject k, HasBinaryProducts k) => Obj k a -> ComonoidObject (ProductFunctor k) a Source #
data MonoidAsCategory f m a b where Source #
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 :: Type -> Type -> Type) Source # | A monoid as a category with one object. |
Defined in Data.Category.Monoidal 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 #
monadFunctor :: Monad f -> 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.