profunctor-extras-3.1: Profunctor extras

Portability MPTCs provisional Edward Kmett None

Data.Profunctor.Rep

Description

Synopsis

# Representable Profunctors

class (Functor f, Profunctor p) => Rep f p whereSource

A `Profunctor` `p` is representable if there exists a `Functor` `f` such that `p d c` is isomorphic to `d -> f c`.

Methods

tabulate :: (d -> f c) -> p d cSource

rep :: p d c -> d -> f cSource

Instances

 Rep Identity (->) (Profunctor (UpStar f), Functor f) => Rep f (UpStar f) (Profunctor (Kleisli m), Monad m, Functor m) => Rep m (Kleisli m) (Functor (Compose f g), Profunctor (Procompose p q), Rep f p, Rep g q) => Rep (Compose f g) (Procompose p q) The composition of two representable profunctors is representable by the composition of their representations.

tabulated :: (Profunctor r, Functor h, Rep f p, Rep g q) => r (p d c) (h (q d' c')) -> r (d -> f c) (h (d' -> g c'))Source

`tabulate` and `rep` form two halves of an isomorphism.

This can be used with the combinators from the `lens` package.

``tabulated` :: `Rep` f p => `Iso'` (d -> f c) (p d c)`

# Corepresentable Profunctors

class (Functor f, Profunctor p) => Corep f p whereSource

A `Profunctor` `p` is representable if there exists a `Functor` `f` such that `p d c` is isomorphic to `d -> f c`.

Methods

cotabulate :: (f d -> c) -> p d cSource

corep :: p d c -> f d -> cSource

Instances

 Corep Identity (->) (Profunctor (DownStar f), Functor f) => Corep f (DownStar f) (Profunctor (Cokleisli w), Functor w) => Corep w (Cokleisli w) Corep (Proxy *) (Tagged *) (Functor (Compose g f), Profunctor (Procompose p q), Corep f p, Corep g q) => Corep (Compose g f) (Procompose p q)

cotabulated :: (Profunctor r, Functor h, Corep f p, Corep g q) => r (p d c) (h (q d' c')) -> r (f d -> c) (h (g d' -> c'))Source

`cotabulate` and `corep` form two halves of an isomorphism.

This can be used with the combinators from the `lens` package.

``tabulated` :: `Corep` f p => `Iso'` (f d -> c) (p d c)`