categories-0.3: Category LibraryContentsIndex
Control.Category.Bifunctor.Monoidal
Portabilitynon-portable (class-associated types)
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Description
A Monoidal category is a category with an associated biendofunctor that has an identity, which satisfies Mac Lane''s pentagonal and triangular coherence conditions Technically we usually say that category is monoidal, but since most interesting categories in our world have multiple candidate bifunctors that you can use to enrich their structure, we choose here to think of the bifunctor as being monoidal. This lets us reuse the same Bifunctor over different categories without painful type annotations.
Synopsis
class Bifunctor p k k k => HasIdentity p k
class (Associative p k, HasIdentity p k) => Monoidal p k where
idl :: k (p (Identity k p) a) a
idr :: k (p a (Identity k p)) a
class (Coassociative p k, HasIdentity p k) => Comonoidal p k where
coidl :: k a (p (Identity k p) a)
coidr :: k a (p a (Identity k p))
Documentation
class Bifunctor p k k k => HasIdentity p k
Denotes that we have some reasonable notion of Identity for a particular Bifunctor in this Category. This notion is currently used by both Monoidal and Comonoidal
show/hide Instances
HasIdentity (,) (->)
HasIdentity p k => HasIdentity p (Dual k)
(Bifunctor f (Reader e k) (Reader e k) (Reader e k), HasIdentity f k) => HasIdentity f (Reader e k)
class (Associative p k, HasIdentity p k) => Monoidal p k where

A monoidal category. idl and idr are traditionally denoted lambda and rho the triangle identity holds:

 first idr = second idl . associate 
 second idl = first idr . associate
Methods
idl :: k (p (Identity k p) a) a
idr :: k (p a (Identity k p)) a
show/hide Instances
Monoidal (,) (->)
Comonoidal p k => Monoidal p (Dual k)
(Bifunctor f (Reader e k) (Reader e k) (Reader e k), Monoidal f k, Cartesian k) => Monoidal f (Reader e k)
class (Coassociative p k, HasIdentity p k) => Comonoidal p k where

A comonoidal category satisfies the dual form of the triangle identities

 first idr = coassociate . second idl
 second idl = coassociate . first idr

This type class is also (ab)used for the inverse operations needed for a strict (co)monoidal category. A strict (co)monoidal category is one that is both Monoidal and Comonoidal and satisfies the following laws:

 idr . coidr = id 
 idl . coidl = id 
 coidl . idl = id 
 coidr . idr = id 
Methods
coidl :: k a (p (Identity k p) a)
coidr :: k a (p a (Identity k p))
show/hide Instances
Comonoidal (,) (->)
Monoidal p k => Comonoidal p (Dual k)
(Bifunctor f (Reader e k) (Reader e k) (Reader e k), Comonoidal f k, Cartesian k) => Comonoidal f (Reader e k)
Produced by Haddock version 0.8