Portability | non-portable (class-associated types) |
---|---|

Stability | experimental |

Maintainer | Edward Kmett <ekmett@gmail.com> |

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.

- class Bifunctor p => HasIdentity p i | p -> i
- class (Associative p, HasIdentity p i) => Monoidal p i | p -> i where
- class (Coassociative p, HasIdentity p i) => Comonoidal p i | p -> i where

# Documentation

class Bifunctor p => HasIdentity p i | p -> iSource

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`

class (Associative p, HasIdentity p i) => Monoidal p i | p -> i whereSource

class (Coassociative p, HasIdentity p i) => Comonoidal p i | p -> i whereSource

A comonoidal category satisfies the dual form of the triangle identities

bimap idr id = coassociate . bimap id idl bimap id idl = coassociate . bimap idr id

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