profunctors-5.2.1: Profunctors

Copyright(C) 2011-2015 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
PortabilityType-Families
Safe HaskellSafe
LanguageHaskell2010

Data.Profunctor.Rep

Contents

Description

 

Synopsis

Representable Profunctors

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

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 :: * -> * #

Methods

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

Instances

Representable (->) # 

Associated Types

type Rep ((->) :: * -> * -> *) :: * -> * #

Methods

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

(Monad m, Functor m) => Representable (Kleisli m) # 

Associated Types

type Rep (Kleisli m :: * -> * -> *) :: * -> * #

Methods

tabulate :: (d -> Rep (Kleisli m) c) -> Kleisli m d c #

Representable (Forget r) # 

Associated Types

type Rep (Forget r :: * -> * -> *) :: * -> * #

Methods

tabulate :: (d -> Rep (Forget r) c) -> Forget r d c #

Functor f => Representable (Star f) # 

Associated Types

type Rep (Star f :: * -> * -> *) :: * -> * #

Methods

tabulate :: (d -> Rep (Star f) c) -> Star f d c #

(Representable p, Representable q) => Representable (Procompose p q) #

The composition of two Representable Profunctors is Representable by the composition of their representations.

Associated Types

type Rep (Procompose p q :: * -> * -> *) :: * -> * #

Methods

tabulate :: (d -> Rep (Procompose p q) c) -> Procompose p q d c #

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

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) #

Default definition for first' given that p is Representable.

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

Default definition for second' given that p is Representable.

Corepresentable Profunctors

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

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 :: * -> * #

Methods

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

Instances

Corepresentable (->) # 

Associated Types

type Corep ((->) :: * -> * -> *) :: * -> * #

Methods

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

Functor w => Corepresentable (Cokleisli w) # 

Associated Types

type Corep (Cokleisli w :: * -> * -> *) :: * -> * #

Methods

cotabulate :: (Corep (Cokleisli w) d -> c) -> Cokleisli w d c #

Corepresentable (Tagged *) # 

Associated Types

type Corep (Tagged * :: * -> * -> *) :: * -> * #

Methods

cotabulate :: (Corep (Tagged *) d -> c) -> Tagged * d c #

Functor f => Corepresentable (Costar f) # 

Associated Types

type Corep (Costar f :: * -> * -> *) :: * -> * #

Methods

cotabulate :: (Corep (Costar f) d -> c) -> Costar f d c #

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

Associated Types

type Corep (Procompose p q :: * -> * -> *) :: * -> * #

Methods

cotabulate :: (Corep (Procompose p q) d -> c) -> Procompose p q d c #

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

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 #

Default definition for unfirst given that p is Corepresentable.

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

Default definition for unsecond given that p is Corepresentable.

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

Default definition for closed given that p is Corepresentable

Prep -| Star

data Prep p a where #

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) # 

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) # 

Methods

fmap :: (a -> b) -> Prep p a -> Prep p b #

(<$) :: a -> Prep p b -> Prep p a #

(Applicative (Rep p), Representable p) => Applicative (Prep p) # 

Methods

pure :: a -> Prep p a #

(<*>) :: Prep p (a -> b) -> Prep p a -> Prep p b #

(*>) :: 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 #

unprepAdj :: (p :-> Star g) -> Prep p a -> g a #

prepCounit :: Prep (Star f) a -> f a #

Coprep -| Costar

newtype Coprep p a #

Constructors

Coprep 

Fields

Instances

Profunctor p => Functor (Coprep p) # 

Methods

fmap :: (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 #

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

Like all adjunctions this gives rise to a monad and a comonad.

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]

uncoprepAdj :: (p :-> Costar f) -> f a -> Coprep p a #

coprepCounit :: f a -> Coprep (Costar f) a #