Portability | GADTs |
---|---|

Stability | provisional |

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

Safe Haskell | Trustworthy |

- data Procompose p q d c where
- Procompose :: p d a -> q a c -> Procompose p q d c

- procomposed :: Category p => Procompose p p a b -> p a b
- idl :: Profunctor q => Iso (Procompose (->) q d c) (Procompose (->) r d' c') (q d c) (r d' c')
- idr :: Profunctor q => Iso (Procompose q (->) d c) (Procompose r (->) d' c') (q d c) (r d' c')
- upstars :: Functor f => Iso (Procompose (UpStar f) (UpStar g) d c) (Procompose (UpStar f') (UpStar g') d' c') (UpStar (Compose f g) d c) (UpStar (Compose f' g') d' c')
- kleislis :: Monad f => Iso (Procompose (Kleisli f) (Kleisli g) d c) (Procompose (Kleisli f') (Kleisli g') d' c') (Kleisli (Compose f g) d c) (Kleisli (Compose f' g') d' c')
- downstars :: Functor g => Iso (Procompose (DownStar f) (DownStar g) d c) (Procompose (DownStar f') (DownStar g') d' c') (DownStar (Compose g f) d c) (DownStar (Compose g' f') d' c')
- cokleislis :: Functor g => Iso (Procompose (Cokleisli f) (Cokleisli g) d c) (Procompose (Cokleisli f') (Cokleisli g') d' c') (Cokleisli (Compose g f) d c) (Cokleisli (Compose g' f') d' c')

# Profunctor Composition

data Procompose p q d c whereSource

is the `Procompose`

p q`Profunctor`

composition of the
`Profunctor`

s `p`

and `q`

.

For a good explanation of `Profunctor`

composition in Haskell
see Dan Piponi's article:

Procompose :: p d a -> q a c -> Procompose p q d c |

(Profunctor p, Profunctor q) => Profunctor (Procompose p q) | |

(Choice p, Choice q) => Choice (Procompose p q) | |

(Strong p, Strong q) => Strong (Procompose p q) | |

(Corepresentable p, Corepresentable q) => Corepresentable (Procompose p q) | |

(Representable p, Representable q) => Representable (Procompose p q) | The composition of two |

Profunctor q => Functor (Procompose p q a) |

procomposed :: Category p => Procompose p p a b -> p a bSource

# Lax identity

idl :: Profunctor q => Iso (Procompose (->) q d c) (Procompose (->) r d' c') (q d c) (r d' c')Source

`(->)`

functions as a lax identity for `Profunctor`

composition.

This provides an `Iso`

for the `lens`

package that witnesses the
isomorphism between

and `Procompose`

(->) q d c`q d c`

, which
is the left identity law.

`idl`

::`Profunctor`

q => Iso' (`Procompose`

(->) q d c) (q d c)

idr :: Profunctor q => Iso (Procompose q (->) d c) (Procompose r (->) d' c') (q d c) (r d' c')Source

`(->)`

functions as a lax identity for `Profunctor`

composition.

This provides an `Iso`

for the `lens`

package that witnesses the
isomorphism between

and `Procompose`

q (->) d c`q d c`

, which
is the right identity law.

`idr`

::`Profunctor`

q => Iso' (`Procompose`

q (->) d c) (q d c)

# Generalized Composition

upstars :: Functor f => Iso (Procompose (UpStar f) (UpStar g) d c) (Procompose (UpStar f') (UpStar g') d' c') (UpStar (Compose f g) d c) (UpStar (Compose f' g') d' c')Source

`Profunctor`

composition generalizes `Functor`

composition in two ways.

This is the first, which shows that `exists b. (a -> f b, b -> g c)`

is
isomorphic to `a -> f (g c)`

.

`upstars`

::`Functor`

f => Iso' (`Procompose`

(`UpStar`

f) (`UpStar`

g) d c) (`UpStar`

(`Compose`

f g) d c)

kleislis :: Monad f => Iso (Procompose (Kleisli f) (Kleisli g) d c) (Procompose (Kleisli f') (Kleisli g') d' c') (Kleisli (Compose f g) d c) (Kleisli (Compose f' g') d' c')Source

downstars :: Functor g => Iso (Procompose (DownStar f) (DownStar g) d c) (Procompose (DownStar f') (DownStar g') d' c') (DownStar (Compose g f) d c) (DownStar (Compose g' f') d' c')Source

`Profunctor`

composition generalizes `Functor`

composition in two ways.

This is the second, which shows that `exists b. (f a -> b, g b -> c)`

is
isomorphic to `g (f a) -> c`

.

`downstars`

::`Functor`

f => Iso' (`Procompose`

(`DownStar`

f) (`DownStar`

g) d c) (`DownStar`

(`Compose`

g f) d c)

cokleislis :: Functor g => Iso (Procompose (Cokleisli f) (Cokleisli g) d c) (Procompose (Cokleisli f') (Cokleisli g') d' c') (Cokleisli (Compose g f) d c) (Cokleisli (Compose g' f') d' c')Source

This is a variant on `downstars`

that uses `Cokleisli`

instead
of `DownStar`

.

`cokleislis`

::`Functor`

f => Iso' (`Procompose`

(`Cokleisli`

f) (`Cokleisli`

g) d c) (`Cokleisli`

(`Compose`

g f) d c)