profunctors-5.6.2: Profunctors
Copyright (C) 2011-2015 Edward Kmett
License BSD-style (see the file LICENSE)
Maintainer Edward Kmett <ekmett@gmail.com>
Stability provisional
Portability Type-Families
Safe Haskell Safe
Language Haskell2010

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 .

Associated Types

type Rep p :: * -> * Source #

Methods

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

Laws:

tabulate . sieveid
sieve . tabulateid

Instances

Instances details
( Monad m, Functor m) => Representable ( Kleisli m) Source #
Instance details

Defined in Data.Profunctor.Rep

Associated Types

type Rep ( Kleisli m) :: Type -> Type Source #

Representable ((->) :: Type -> Type -> Type ) Source #
Instance details

Defined in Data.Profunctor.Rep

Associated Types

type Rep (->) :: Type -> Type Source #

Methods

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

Representable ( Forget r :: Type -> Type -> Type ) Source #
Instance details

Defined in Data.Profunctor.Rep

Associated Types

type Rep ( Forget r) :: Type -> Type Source #

Methods

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

Functor f => Representable ( Star f) Source #
Instance details

Defined in Data.Profunctor.Rep

Associated Types

type Rep ( Star f) :: Type -> Type Source #

Methods

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

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

The composition of two Representable Profunctor s is Representable by the composition of their representations.

Instance details

Defined in Data.Profunctor.Composition

Associated Types

type Rep ( Procompose p q) :: Type -> Type 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 .

Associated Types

type Corep p :: * -> * Source #

Methods

cotabulate :: ( Corep p d -> c) -> p 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 )

Prep has a polymorphic kind since 5.6 .

Constructors

Prep :: x -> p x a -> Prep p a

prepAdj :: ( forall a. Prep p a -> g a) -> p :-> Star g Source #

Coprep -| Costar

newtype Coprep p a Source #

Prep has a polymorphic kind since 5.6 .

Constructors

Coprep

Fields

Instances

Instances details
Profunctor p => Functor ( Coprep p) Source #
Instance details

Defined in Data.Profunctor.Rep

Methods

fmap :: (a -> b) -> Coprep p a -> Coprep p b Source #

(<$) :: a -> Coprep p b -> Coprep p a Source #

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

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]