categories-0.56.0: categories from category-extras

Portabilitynon-portable (class-associated types)
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>

Control.Category.Monoidal

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 newtype wrapping.

Synopsis

Documentation

class Bifunctor p k k k => HasIdentity k p Source

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

Associated Types

type Id k p :: *Source

Instances

class (Associative k p, HasIdentity k p) => Monoidal k p whereSource

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 (Id k p) a) aSource

idr :: k (p a (Id k p)) aSource

Instances

Monoidal (->) (,) 

class (Disassociative k p, HasIdentity k p) => Comonoidal k p whereSource

A comonoidal category satisfies the dual form of the triangle identities

 first idr = disassociate . second idl
 second idl = disassociate . 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 (Id k p) a)Source

coidr :: k a (p a (Id k p))Source