monoidal-functors-0.2.3.0: Monoidal Functors Library
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Category.Cartesian

Synopsis

Semicartesian

class Symmetric cat t => Semicartesian cat t where Source #

A Category is Semicartesian if it is equipped with a Symmetric bifunctor t and each object comes equipped with a diagonal morphism \(\Delta_x: x \to x \otimes x \), which we call split.

Laws

grmap split . splitbwd assoc . glmap split . split
glmap split . splitfwd assoc . grmap split . split

Minimal complete definition

split

Methods

split :: cat a (a `t` a) Source #

The diagonal morphism of a in cat. We can think of split as duplicating data.

Examples

Expand
>>> split @(->) @(,) True
(True,True)

fork :: cat a x -> cat a y -> cat a (x `t` y) Source #

Given morphisms cat a x and cat a y, construct the universal map cat a (x `t` y).

Examples

Expand
>>> :t fork @(->) @(,) show not
fork @(->) @(,) show not :: Bool -> (String, Bool)
>>> fork @(->) @(,) show not True
("True",False)

Instances

Instances details
Semicocartesian (->) t => Semicartesian Op t Source # 
Instance details

Defined in Control.Category.Cartesian

Methods

split :: Op a (t a a) Source #

fork :: Op a x -> Op a y -> Op a (t x y) Source #

Semicartesian (->) (,) Source # 
Instance details

Defined in Control.Category.Cartesian

Methods

split :: a -> (a, a) Source #

fork :: (a -> x) -> (a -> y) -> a -> (x, y) Source #

(/\) :: Semicartesian cat t => cat a x -> cat a y -> cat a (x `t` y) infixr 9 Source #

Infix version of fork.

Semicocartesian

class Symmetric cat t => Semicocartesian cat t where Source #

A Category is Semicocartesian if it is equipped with a Symmetric type operator t and each object comes equipped with a morphism \(\Delta^{-1}_x: x \otimes x \to x\), which we call merge.

Laws

merge . grmap mergemerge . glmap merge . fwd assoc
merge . glmap mergemerge . grmap merge . bwd assoc

Minimal complete definition

merge

Methods

merge :: cat (a `t` a) a Source #

The co-diagonal morphism of a in cat.

Examples

Expand
>>> :t merge @(->) @(Either) (Left True)
merge @(->) @(Either) (Left True) :: Bool
>>> merge @(->) @(Either) (Left True)
True

fuse :: cat x a -> cat y a -> cat (x `t` y) a Source #

Given morphisms cat x a and cat y a, construct the universal map cat (x `t` y) a.

Examples

Instances

Instances details
Semicartesian (->) t => Semicocartesian Op t Source # 
Instance details

Defined in Control.Category.Cartesian

Methods

merge :: Op (t a a) a Source #

fuse :: Op x a -> Op y a -> Op (t x y) a Source #

Semicocartesian (->) Either Source # 
Instance details

Defined in Control.Category.Cartesian

Methods

merge :: Either a a -> a Source #

fuse :: (x -> a) -> (y -> a) -> Either x y -> a Source #

(\/) :: Semicocartesian cat t => cat x a -> cat y a -> cat (x `t` y) a infixr 9 Source #

Infix version of fuse.

Cartesian

class (Semicartesian cat t, Tensor cat t i) => Cartesian cat t i | i -> t, t -> i where Source #

A Category equipped with a Tensor t where the Tensor unit i is the terminal object in cat and thus every object a is equipped with a morphism \(e_x: x \to I\), which we call kill.

Laws

fwd unitl . glmap kill . splitid
fwd unitr . grmap kill . splitid

Minimal complete definition

kill

Methods

kill :: cat a i Source #

A morphism from the a to the terminal object i in @cat. We can think of kill as deleting data where split duplicates it.

Examples

Expand
>>> kill @(->) @(,) @() True
()

projl :: cat (x `t` y) x Source #

The left projection for t.

Examples

Expand
>>> projl @(->) @(,) (True, "hello")
True

projr :: cat (x `t` y) y Source #

The right projection for t.

Examples

Expand
>>> projr @(->) @(,) (True, "hello")
"hello"

unfork :: cat a (x `t` y) -> (cat a x, cat a y) Source #

Given the universal map cat a (x t y), construct morphisms cat a x and cat a y.

Examples

Instances

Instances details
Cocartesian (->) t i => Cartesian Op t i Source # 
Instance details

Defined in Control.Category.Cartesian

Methods

kill :: Op a i Source #

projl :: Op (t x y) x Source #

projr :: Op (t x y) y Source #

unfork :: Op a (t x y) -> (Op a x, Op a y) Source #

Cartesian (->) (,) () Source # 
Instance details

Defined in Control.Category.Cartesian

Methods

kill :: a -> () Source #

projl :: (x, y) -> x Source #

projr :: (x, y) -> y Source #

unfork :: (a -> (x, y)) -> (a -> x, a -> y) Source #

Cocartesian

class (Semicocartesian cat t, Tensor cat t i) => Cocartesian cat t i | i -> t, t -> i where Source #

A Category equipped with a Tensor t where the Tensor unit i is the initial object in cat and thus every object a is equipped with a morphism \(e^{-1}_x: I \to x\), which we call spawn.

Laws

merge . glmap spawn . bwd unitlid
merge . grmap spawn . bwd unitrid

Minimal complete definition

spawn

Methods

spawn :: cat i a Source #

A morphism from the initial object i in cat to a.

Examples

incll :: cat x (x `t` y) Source #

The left inclusion for t.

Examples

inclr :: cat y (x `t` y) Source #

The right inclusion for t.

Examples

unfuse :: cat (x `t` y) a -> (cat x a, cat y a) Source #

Given the universal map cat (x t y) a, construct morphisms cat x a and cat y a.

Examples

Instances

Instances details
Cartesian (->) t i => Cocartesian Op t i Source # 
Instance details

Defined in Control.Category.Cartesian

Methods

spawn :: Op i a Source #

incll :: Op x (t x y) Source #

inclr :: Op y (t x y) Source #

unfuse :: Op (t x y) a -> (Op x a, Op y a) Source #

Cocartesian (->) Either Void Source # 
Instance details

Defined in Control.Category.Cartesian

Methods

spawn :: Void -> a Source #

incll :: x -> Either x y Source #

inclr :: y -> Either x y Source #

unfuse :: (Either x y -> a) -> (x -> a, y -> a) Source #