proarrow
Safe HaskellNone
LanguageGHC2024

Proarrow.Squares.BinaryCoproduct

Description

Pointwise binary coproducts as codiagonal-weighted colimits.

Synopsis

Documentation

type Diagram (f :: j +-> k) (g :: j +-> k) = (RepCostar f :++: RepCostar g) :.: Corep (Codiag :: COPRODUCT k k +-> k) Source Github #

A pair of functors, encoded as a corepresentable diagram.

coproduct :: forall {j} {k} (f :: j +-> k) (g :: j +-> k). (HasBinaryCoproducts k, Representable f, Representable g) => Sq (Corep (Codiag :: COPRODUCT j j +-> j) '::: ('Nil :: Path (COPRODUCT j j) (COPRODUCT j j))) ('Nil :: Path k k) (CorepStar (Diagram f g) '::: ('Nil :: Path k k)) (Sum f g '::: ('Nil :: Path k k)) Source Github #

The injection cocone. The vertical codiagonal weight selects either component.

J+J-----codiag--------J
|          |          |
d>---------@--------->s
|                     |
K---------------------K

Here d = CorepStar (Diagram f g) and s = Sum f g.

copair :: forall {j} {k} (f :: j +-> k) (g :: j +-> k) (p :: j +-> k). (HasBinaryCoproducts k, Representable f, Representable g, Representable p) => Sq (Corep (Codiag :: COPRODUCT j j +-> j) '::: ('Nil :: Path (COPRODUCT j j) (COPRODUCT j j))) ('Nil :: Path k k) (CorepStar (Diagram f g) '::: ('Nil :: Path k k)) (p '::: ('Nil :: Path k k)) -> Sq ('Nil :: Path j j) ('Nil :: Path k k) (Sum f g '::: ('Nil :: Path k k)) (p '::: ('Nil :: Path k k)) Source Github #

Factor a cocone through the pointwise coproduct. Composing coproduct with the result recovers the input cocone, uniquely. The dotted inner square is the input; the outer square is the factor.

J-------------------J
|                   |
|  J+J.codiag...J   |
|   :     |     :   |
s   d>----@-------->p
|   :           :   |
|   K...........K   |
|                   |
K-------------------K

lft :: forall {j} {k} (f :: j +-> k) (g :: j +-> k). (HasBinaryCoproducts k, Representable f, Representable g) => Sq ('Nil :: Path j j) ('Nil :: Path k k) (f '::: ('Nil :: Path k k)) (Sum f g '::: ('Nil :: Path k k)) Source Github #

Select the first component of the injection cocone.

rgt :: forall {j} {k} (f :: j +-> k) (g :: j +-> k). (HasBinaryCoproducts k, Representable f, Representable g) => Sq ('Nil :: Path j j) ('Nil :: Path k k) (g '::: ('Nil :: Path k k)) (Sum f g '::: ('Nil :: Path k k)) Source Github #

Select the second component of the injection cocone.