profunctors-5.6.2: 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 :: k -> k1 -> Type) (q :: k -> k2 -> Type) (a :: k1) (b :: k2) = Ran {
  - runRan :: forall (x :: k). p x a -> q x b
  }
- decomposeRan :: forall {k1} {k2} {k3} (q :: k1 -> k2 -> Type) p (a :: k1) (b :: k3). Procompose (Ran q p) q a b -> p a b
- precomposeRan :: forall {k} (q :: Type -> Type -> Type) (p :: Type -> k -> Type). Profunctor q => Procompose q (Ran p (->)) :-> Ran p q
- curryRan :: forall {k1} {k2} {k3} (p :: k1 -> k2 -> Type) (q :: k3 -> k1 -> Type) (r :: k3 -> k2 -> Type). (Procompose p q :-> r) -> p :-> Ran q r
- uncurryRan :: forall {k1} {k2} {k3} (p :: k1 -> k2 -> Type) (q :: k3 -> k1 -> Type) (r :: k3 -> k2 -> Type). (p :-> Ran q r) -> Procompose p q :-> r
- newtype Codensity (p :: k -> k1 -> Type) (a :: k1) (b :: k1) = Codensity {
  - runCodensity :: forall (x :: k). p x a -> p x b
  }
- decomposeCodensity :: forall {k2} {k1} p (a :: k2) (b :: k1). Procompose (Codensity p) p a b -> p a b

# Documentation

newtype Ran (p :: k -> k1 -> Type) (q :: k -> k2 -> Type) (a :: k1) (b :: k2) #

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.

`Ran` has a polymorphic kind since `5.6`.

Constructors

Ran |

Fields

- runRan :: forall (x :: k). p x a -> q x b

#### Instances

Instances details

ProfunctorFunctor (Ran p :: (Type -> Type -> Type) -> k -> Type -> Type) # |
Instance details Defined in Data.Profunctor.Ran Methods promap :: forall (p0 :: Type -> Type -> Type) (q :: Type -> Type -> Type). Profunctor p0 => (p0 :-> q) -> Ran p p0 :-> Ran p q #
p ~ q => Category (Ran p q :: k2 -> k2 -> Type) # | ``Ran` p p` forms a `Monad` in the `Profunctor` 2-category, which is isomorphic to a Haskell `Category` instance.
Instance details Defined in Data.Profunctor.Ran Methods id :: forall (a :: k2). Ran p q a a # (.) :: forall (b :: k2) (c :: k2) (a :: k2). Ran p q b c -> Ran p q a b -> Ran p q a c #
Category p => ProfunctorComonad (Ran p :: (Type -> Type -> Type) -> Type -> Type -> Type) # |
Instance details Defined in Data.Profunctor.Ran Methods proextract :: forall (p0 :: Type -> Type -> Type). Profunctor p0 => Ran p p0 :-> p0 # produplicate :: forall (p0 :: Type -> Type -> Type). Profunctor p0 => Ran p p0 :-> Ran p (Ran p p0) #
(Profunctor p, Profunctor q) => Profunctor (Ran p q) # |
Instance details Defined in Data.Profunctor.Ran Methods dimap :: (a -> b) -> (c -> d) -> Ran p q b c -> Ran p q a d # lmap :: (a -> b) -> Ran p q b c -> Ran p q a c # rmap :: (b -> c) -> Ran p q a b -> Ran p q a c # (#.) :: forall a b c q0. Coercible c b => q0 b c -> Ran p q a b -> Ran p q a c # (.#) :: forall a b c q0. Coercible b a => Ran p q b c -> q0 a b -> Ran p q a c #
Profunctor q => Functor (Ran p q a) # |
Instance details Defined in Data.Profunctor.Ran Methods fmap :: (a0 -> b) -> Ran p q a a0 -> Ran p q a b # (<$) :: a0 -> Ran p q a b -> Ran p q a a0 #

decomposeRan :: forall {k1} {k2} {k3} (q :: k1 -> k2 -> Type) p (a :: k1) (b :: k3). Procompose (Ran q p) q a b -> p a b #

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 :: forall {k} (q :: Type -> Type -> Type) (p :: Type -> k -> Type). Profunctor q => Procompose q (Ran p (->)) :-> Ran p q #

curryRan :: forall {k1} {k2} {k3} (p :: k1 -> k2 -> Type) (q :: k3 -> k1 -> Type) (r :: k3 -> k2 -> Type). (Procompose p q :-> r) -> p :-> Ran q r #

uncurryRan :: forall {k1} {k2} {k3} (p :: k1 -> k2 -> Type) (q :: k3 -> k1 -> Type) (r :: k3 -> k2 -> Type). (p :-> Ran q r) -> Procompose p q :-> r #

newtype Codensity (p :: k -> k1 -> Type) (a :: k1) (b :: k1) #

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

`Codensity` has a polymorphic kind since `5.6`.

Constructors

Codensity |

Fields

- runCodensity :: forall (x :: k). p x a -> p x b

#### Instances

Instances details

Category (Codensity p :: k2 -> k2 -> Type) # |
Instance details Defined in Data.Profunctor.Ran Methods id :: forall (a :: k2). Codensity p a a # (.) :: forall (b :: k2) (c :: k2) (a :: k2). Codensity p b c -> Codensity p a b -> Codensity p a c #
Profunctor p => Profunctor (Codensity p) # |

Instance details

Defined in Data.Profunctor.Ran

Methods

dimap :: (a -> b) -> (c -> d) -> Codensity p b c -> Codensity p a d #

lmap :: (a -> b) -> Codensity p b c -> Codensity p a c #

rmap :: (b -> c) -> Codensity p a b -> Codensity p a c #

(#.) :: forall a b c q. Coercible c b => q b c -> Codensity p a b -> Codensity p a c #

(.#) :: forall a b c q. Coercible b a => Codensity p b c -> q a b -> Codensity p a c #

Profunctor p => Functor (Codensity p a) # |
Instance details Defined in Data.Profunctor.Ran Methods fmap :: (a0 -> b) -> Codensity p a a0 -> Codensity p a b # (<$) :: a0 -> Codensity p a b -> Codensity p a a0 #

decomposeCodensity :: forall {k2} {k1} p (a :: k2) (b :: k1). Procompose (Codensity p) p a b -> p a b #