profunctors-5.2.1: Profunctors

Copyright | (C) 2013-2015 Edward Kmett and Dan Doel
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | provisional
Portability | Rank2Types, TFs
Safe Haskell | Safe
Language | Haskell2010

Data.Profunctor.Ran

Description

Synopsis

- newtype Ran p q a b = Ran {
  - runRan :: forall x. p x a -> q x b
  }
- decomposeRan :: Procompose (Ran q p) q :-> p
- precomposeRan :: Profunctor q => Procompose q (Ran p (->)) :-> Ran p q
- curryRan :: (Procompose p q :-> r) -> p :-> Ran q r
- uncurryRan :: (p :-> Ran q r) -> Procompose p q :-> r
- newtype Codensity p a b = Codensity {
  - runCodensity :: forall x. p x a -> p x b
  }
- decomposeCodensity :: Procompose (Codensity p) p a b -> p a b

# Documentation

newtype Ran p q a b Source #

This represents the right Kan extension of a `Profunctor` `q` along a `Profunctor` `p` in a limited version of the 2-category of Profunctors where the only object is the category Hask, 1-morphisms are profunctors composed and compose with Profunctor composition, and 2-morphisms are just natural transformations.

Constructors

Ran |

Fields

- runRan :: forall x. p x a -> q x b

Instances

Category * p => ProfunctorComonad (Ran p) Source # |
Methods proextract :: Profunctor p => Ran p p :-> p Source # produplicate :: Profunctor p => Ran p p :-> Ran p (Ran p p) Source #
ProfunctorFunctor (Ran p) Source # |
Methods promap :: Profunctor p => (p :-> q) -> Ran p p :-> Ran p q Source #
(~) (* -> * -> *) p q => Category * (Ran p q) Source # | ``Ran` p p` forms a `Monad` in the `Profunctor` 2-category, which is isomorphic to a Haskell `Category` instance.
Methods id :: cat a a # (.) :: cat b c -> cat a b -> cat a c #
(Profunctor p, Profunctor q) => Profunctor (Ran p q) Source # |
Methods dimap :: (a -> b) -> (c -> d) -> Ran p q b c -> Ran p q a d Source # lmap :: (a -> b) -> Ran p q b c -> Ran p q a c Source # rmap :: (b -> c) -> Ran p q a b -> Ran p q a c Source # (#.) :: Coercible * c b => (b -> c) -> Ran p q a b -> Ran p q a c Source # (.#) :: Coercible * b a => Ran p q b c -> (a -> b) -> Ran p q a c Source #
Profunctor q => Functor (Ran p q a) Source # |
Methods fmap :: (a -> b) -> Ran p q a a -> Ran p q a b # (<$) :: a -> Ran p q a b -> Ran p q a a #

decomposeRan :: Procompose (Ran q p) q :-> p Source #

The 2-morphism that defines a right Kan extension.

Note: When `q` is left adjoint to ``Ran` q (->)` then `decomposeRan` is the `counit` of the adjunction.

precomposeRan :: Profunctor q => Procompose q (Ran p (->)) :-> Ran p q Source #

curryRan :: (Procompose p q :-> r) -> p :-> Ran q r Source #

uncurryRan :: (p :-> Ran q r) -> Procompose p q :-> r Source #

newtype Codensity p a b Source #

This represents the right Kan extension of a `Profunctor` `p` along itself. This provides a generalization of the "difference list" trick to profunctors.

Constructors

Codensity |

Fields

- runCodensity :: forall x. p x a -> p x b

Instances

Profunctor p => Profunctor (Codensity p) Source # |
Methods dimap :: (a -> b) -> (c -> d) -> Codensity p b c -> Codensity p a d Source # lmap :: (a -> b) -> Codensity p b c -> Codensity p a c Source # rmap :: (b -> c) -> Codensity p a b -> Codensity p a c Source # (#.) :: Coercible * c b => (b -> c) -> Codensity p a b -> Codensity p a c Source # (.#) :: Coercible * b a => Codensity p b c -> (a -> b) -> Codensity p a c Source #
Category * (Codensity p) Source # |
Methods id :: cat a a # (.) :: cat b c -> cat a b -> cat a c #
Profunctor p => Functor (Codensity p a) Source # |
Methods fmap :: (a -> b) -> Codensity p a a -> Codensity p a b # (<$) :: a -> Codensity p a b -> Codensity p a a #

decomposeCodensity :: Procompose (Codensity p) p a b -> p a b Source #