proarrow
Safe HaskellNone
LanguageGHC2024

Proarrow.Squares.BinaryProduct

Description

Pointwise binary products as codiagonal-weighted limits.

Synopsis

Documentation

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

A pair of functors, viewed as one diagram on the disjoint union of their domains.

product :: forall {j} {k} (f :: j +-> k) (g :: j +-> k). (HasBinaryProducts k, Representable f, Representable g) => Sq (Rep (Codiag :: COPRODUCT j j +-> j) '::: ('Nil :: Path j j)) ('Nil :: Path k k) ((f :*: g) '::: ('Nil :: Path k k)) (Diagram f g '::: ('Nil :: Path k k)) Source Github #

The projection cone. The vertical codiagonal weight selects either component.

J-------codiag-------J+J
|          |          |
f*g>-------@--------->d
|                     |
K---------------------K

Here d = Diagram f g and f*g is the pointwise product.

pair :: forall {j} {k} (f :: j +-> k) (g :: j +-> k) (p :: j +-> k). (HasBinaryProducts k, Representable f, Representable g, Representable p) => Sq (Rep (Codiag :: COPRODUCT j j +-> j) '::: ('Nil :: Path j j)) ('Nil :: Path k k) (p '::: ('Nil :: Path k k)) (Diagram f g '::: ('Nil :: Path k k)) -> Sq ('Nil :: Path j j) ('Nil :: Path k k) (p '::: ('Nil :: Path k k)) ((f :*: g) '::: ('Nil :: Path k k)) Source Github #

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

J-------------------J
|                   |
|   J..codiag..J+J  |
|   :     |     :   |
p>--------@---->d  f*g
|   :           :   |
|   K...........K   |
|                   |
K-------------------K

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

Select the first component of the projection cone.

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

Select the second component of the projection cone.