profunctors-5.2.2: Profunctors

Data.Profunctor.Rep

Description

Synopsis

# Representable Profunctors

class (Sieve p (Rep p), Strong p) => Representable p where Source #

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

Minimal complete definition

tabulate

Associated Types

type Rep p :: * -> * Source #

Methods

tabulate :: (d -> Rep p c) -> p d c Source #

Laws:

tabulate . sieve ≡ id
sieve . tabulate ≡ id

Instances
 (Monad m, Functor m) => Representable (Kleisli m) Source # Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Rep (Kleisli m) :: * -> * Source # Methodstabulate :: (d -> Rep (Kleisli m) c) -> Kleisli m d c Source # Source # Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Rep (Forget r) :: * -> * Source # Methodstabulate :: (d -> Rep (Forget r) c) -> Forget r d c Source # Functor f => Representable (Star f) Source # Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Rep (Star f) :: * -> * Source # Methodstabulate :: (d -> Rep (Star f) c) -> Star f d c Source # Representable ((->) :: * -> * -> *) Source # Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Rep (->) :: * -> * Source # Methodstabulate :: (d -> Rep (->) c) -> d -> c Source # (Representable p, Representable q) => Representable (Procompose p q) Source # The composition of two Representable Profunctors is Representable by the composition of their representations. Instance detailsDefined in Data.Profunctor.Composition Associated Typestype Rep (Procompose p q) :: * -> * Source # Methodstabulate :: (d -> Rep (Procompose p q) c) -> Procompose p q d c Source #

tabulated :: (Representable p, Representable q) => Iso (d -> Rep p c) (d' -> Rep q c') (p d c) (q d' c') Source #

tabulate and sieve form two halves of an isomorphism.

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

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

firstRep :: Representable p => p a b -> p (a, c) (b, c) Source #

Default definition for first' given that p is Representable.

secondRep :: Representable p => p a b -> p (c, a) (c, b) Source #

Default definition for second' given that p is Representable.

# Corepresentable Profunctors

class (Cosieve p (Corep p), Costrong p) => Corepresentable p where Source #

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

Minimal complete definition

cotabulate

Associated Types

type Corep p :: * -> * Source #

Methods

cotabulate :: (Corep p d -> c) -> p d c Source #

Laws:

cotabulate . cosieve ≡ id
cosieve . cotabulate ≡ id

Instances
 Source # Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Corep (Cokleisli w) :: * -> * Source # Methodscotabulate :: (Corep (Cokleisli w) d -> c) -> Cokleisli w d c Source # Corepresentable (Tagged :: * -> * -> *) Source # Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Corep Tagged :: * -> * Source # Methodscotabulate :: (Corep Tagged d -> c) -> Tagged d c Source # Functor f => Corepresentable (Costar f) Source # Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Corep (Costar f) :: * -> * Source # Methodscotabulate :: (Corep (Costar f) d -> c) -> Costar f d c Source # Corepresentable ((->) :: * -> * -> *) Source # Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Corep (->) :: * -> * Source # Methodscotabulate :: (Corep (->) d -> c) -> d -> c Source # Source # Instance detailsDefined in Data.Profunctor.Composition Associated Typestype Corep (Procompose p q) :: * -> * Source # Methodscotabulate :: (Corep (Procompose p q) d -> c) -> Procompose p q d c Source #

cotabulated :: (Corepresentable p, Corepresentable q) => Iso (Corep p d -> c) (Corep q d' -> c') (p d c) (q d' c') Source #

cotabulate and cosieve form two halves of an isomorphism.

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

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

unfirstCorep :: Corepresentable p => p (a, d) (b, d) -> p a b Source #

Default definition for unfirst given that p is Corepresentable.

unsecondCorep :: Corepresentable p => p (d, a) (d, b) -> p a b Source #

Default definition for unsecond given that p is Corepresentable.

closedCorep :: Corepresentable p => p a b -> p (x -> a) (x -> b) Source #

Default definition for closed given that p is Corepresentable

# Prep -| Star

data Prep p a where Source #

Prep -| Star :: [Hask, Hask] -> Prof

This gives rise to a monad in Prof, ('Star'.'Prep'), and a comonad in [Hask,Hask] ('Prep'.'Star')

Constructors

 Prep :: x -> p x a -> Prep p a
Instances
 (Monad (Rep p), Representable p) => Monad (Prep p) Source # Instance detailsDefined in Data.Profunctor.Rep Methods(>>=) :: Prep p a -> (a -> Prep p b) -> Prep p b #(>>) :: Prep p a -> Prep p b -> Prep p b #return :: a -> Prep p a #fail :: String -> Prep p a # Profunctor p => Functor (Prep p) Source # Instance detailsDefined in Data.Profunctor.Rep Methodsfmap :: (a -> b) -> Prep p a -> Prep p b #(<$) :: a -> Prep p b -> Prep p a # (Applicative (Rep p), Representable p) => Applicative (Prep p) Source # Instance detailsDefined in Data.Profunctor.Rep Methodspure :: a -> Prep p a #(<*>) :: Prep p (a -> b) -> Prep p a -> Prep p b #liftA2 :: (a -> b -> c) -> Prep p a -> Prep p b -> Prep p c #(*>) :: Prep p a -> Prep p b -> Prep p b #(<*) :: Prep p a -> Prep p b -> Prep p a # prepAdj :: (forall a. Prep p a -> g a) -> p :-> Star g Source # unprepAdj :: (p :-> Star g) -> Prep p a -> g a Source # prepCounit :: Prep (Star f) a -> f a Source # # Coprep -| Costar newtype Coprep p a Source # Constructors  Coprep FieldsrunCoprep :: forall r. p a r -> r Instances  Profunctor p => Functor (Coprep p) Source # Instance detailsDefined in Data.Profunctor.Rep Methodsfmap :: (a -> b) -> Coprep p a -> Coprep p b #(<$) :: a -> Coprep p b -> Coprep p a #

coprepAdj :: (forall a. f a -> Coprep p a) -> p :-> Costar f Source #

Coprep -| Costar :: [Hask, Hask]^op -> Prof

This gives rise to a monad on Prof ('Costar'.'Coprep') and a comonad on [Hask, Hask]^op given by ('Coprep'.'Costar') which is a monad in [Hask,Hask]