profunctors-5.2.1: Profunctors

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

Data.Profunctor.Yoneda

Description

Synopsis

- newtype Yoneda p a b = Yoneda {
  - runYoneda :: forall x y. (x -> a) -> (b -> y) -> p x y
  }
- extractYoneda :: Yoneda p a b -> p a b
- duplicateYoneda :: Yoneda p a b -> Yoneda (Yoneda p) a b
- data Coyoneda p a b where
  - Coyoneda :: (a -> x) -> (y -> b) -> p x y -> Coyoneda p a b
- returnCoyoneda :: p a b -> Coyoneda p a b
- joinCoyoneda :: Coyoneda (Coyoneda p) a b -> Coyoneda p a b

# Documentation

newtype Yoneda p a b Source #

This is the cofree profunctor given a data constructor of kind `* -> * -> *`

Constructors

Yoneda |

Fields

- runYoneda :: forall x y. (x -> a) -> (b -> y) -> p x y

Instances

ProfunctorComonad Yoneda Source # |
Methods proextract :: Profunctor p => Yoneda p :-> p Source # produplicate :: Profunctor p => Yoneda p :-> Yoneda (Yoneda p) Source #
ProfunctorMonad Yoneda Source # |
Methods proreturn :: Profunctor p => p :-> Yoneda p Source # projoin :: Profunctor p => Yoneda (Yoneda p) :-> Yoneda p Source #
ProfunctorFunctor Yoneda Source # |
Methods promap :: Profunctor p => (p :-> q) -> Yoneda p :-> Yoneda q Source #
Profunctor (Yoneda p) Source # |
Methods dimap :: (a -> b) -> (c -> d) -> Yoneda p b c -> Yoneda p a d Source # lmap :: (a -> b) -> Yoneda p b c -> Yoneda p a c Source # rmap :: (b -> c) -> Yoneda p a b -> Yoneda p a c Source # (#.) :: Coercible * c b => (b -> c) -> Yoneda p a b -> Yoneda p a c Source # (.#) :: Coercible * b a => Yoneda p b c -> (a -> b) -> Yoneda p a c Source #
Costrong p => Costrong (Yoneda p) Source # |
Methods unfirst :: Yoneda p (a, d) (b, d) -> Yoneda p a b Source # unsecond :: Yoneda p (d, a) (d, b) -> Yoneda p a b Source #
Strong p => Strong (Yoneda p) Source # |
Methods first' :: Yoneda p a b -> Yoneda p (a, c) (b, c) Source # second' :: Yoneda p a b -> Yoneda p (c, a) (c, b) Source #
Cochoice p => Cochoice (Yoneda p) Source # |
Methods unleft :: Yoneda p (Either a d) (Either b d) -> Yoneda p a b Source # unright :: Yoneda p (Either d a) (Either d b) -> Yoneda p a b Source #
Choice p => Choice (Yoneda p) Source # |
Methods left' :: Yoneda p a b -> Yoneda p (Either a c) (Either b c) Source # right' :: Yoneda p a b -> Yoneda p (Either c a) (Either c b) Source #
Closed p => Closed (Yoneda p) Source # |
Methods closed :: Yoneda p a b -> Yoneda p (x -> a) (x -> b) Source #
Traversing p => Traversing (Yoneda p) Source # |
Methods traverse' :: Traversable f => Yoneda p a b -> Yoneda p (f a) (f b) Source # wander :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> Yoneda p a b -> Yoneda p s t Source #
Mapping p => Mapping (Yoneda p) Source # |
Methods map' :: Functor f => Yoneda p a b -> Yoneda p (f a) (f b) Source #
(Category * p, Profunctor p) => Category * (Yoneda p) Source # |
Methods id :: cat a a # (.) :: cat b c -> cat a b -> cat a c #
Functor (Yoneda p a) Source # |
Methods fmap :: (a -> b) -> Yoneda p a a -> Yoneda p a b # (<$) :: a -> Yoneda p a b -> Yoneda p a a #

extractYoneda :: Yoneda p a b -> p a b Source #

    projoin . extractYoneda ≡ id
    extractYoneda . projoin ≡ id
    projoin ≡ extractYoneda

duplicateYoneda :: Yoneda p a b -> Yoneda (Yoneda p) a b Source #

    projoin . duplicateYoneda ≡ id
    duplicateYoneda . projoin ≡ id
    duplicateYoneda = proreturn

data Coyoneda p a b where Source #

Constructors

Coyoneda :: (a -> x) -> (y -> b) -> p x y -> Coyoneda p a b |

Instances

ProfunctorComonad Coyoneda Source # |
Methods proextract :: Profunctor p => Coyoneda p :-> p Source # produplicate :: Profunctor p => Coyoneda p :-> Coyoneda (Coyoneda p) Source #
ProfunctorMonad Coyoneda Source # |
Methods proreturn :: Profunctor p => p :-> Coyoneda p Source # projoin :: Profunctor p => Coyoneda (Coyoneda p) :-> Coyoneda p Source #
ProfunctorFunctor Coyoneda Source # |
Methods promap :: Profunctor p => (p :-> q) -> Coyoneda p :-> Coyoneda q Source #
Profunctor (Coyoneda p) Source # |
Methods dimap :: (a -> b) -> (c -> d) -> Coyoneda p b c -> Coyoneda p a d Source # lmap :: (a -> b) -> Coyoneda p b c -> Coyoneda p a c Source # rmap :: (b -> c) -> Coyoneda p a b -> Coyoneda p a c Source # (#.) :: Coercible * c b => (b -> c) -> Coyoneda p a b -> Coyoneda p a c Source # (.#) :: Coercible * b a => Coyoneda p b c -> (a -> b) -> Coyoneda p a c Source #
Costrong p => Costrong (Coyoneda p) Source # |
Methods unfirst :: Coyoneda p (a, d) (b, d) -> Coyoneda p a b Source # unsecond :: Coyoneda p (d, a) (d, b) -> Coyoneda p a b Source #
Strong p => Strong (Coyoneda p) Source # |
Methods first' :: Coyoneda p a b -> Coyoneda p (a, c) (b, c) Source # second' :: Coyoneda p a b -> Coyoneda p (c, a) (c, b) Source #
Cochoice p => Cochoice (Coyoneda p) Source # |
Methods unleft :: Coyoneda p (Either a d) (Either b d) -> Coyoneda p a b Source # unright :: Coyoneda p (Either d a) (Either d b) -> Coyoneda p a b Source #
Choice p => Choice (Coyoneda p) Source # |
Methods left' :: Coyoneda p a b -> Coyoneda p (Either a c) (Either b c) Source # right' :: Coyoneda p a b -> Coyoneda p (Either c a) (Either c b) Source #
Closed p => Closed (Coyoneda p) Source # |
Methods closed :: Coyoneda p a b -> Coyoneda p (x -> a) (x -> b) Source #
Traversing p => Traversing (Coyoneda p) Source # |
Methods traverse' :: Traversable f => Coyoneda p a b -> Coyoneda p (f a) (f b) Source # wander :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> Coyoneda p a b -> Coyoneda p s t Source #
Mapping p => Mapping (Coyoneda p) Source # |
Methods map' :: Functor f => Coyoneda p a b -> Coyoneda p (f a) (f b) Source #
(Category * p, Profunctor p) => Category * (Coyoneda p) Source # |
Methods id :: cat a a # (.) :: cat b c -> cat a b -> cat a c #

returnCoyoneda :: p a b -> Coyoneda p a b Source #

    returnCoyoneda . proextract ≡ id
    proextract . returnCoyoneda ≡ id
    produplicate ≡ returnCoyoneda

joinCoyoneda :: Coyoneda (Coyoneda p) a b -> Coyoneda p a b Source #

    joinCoyoneda . produplicate ≡ id
    produplicate . joinCoyoneda ≡ id
    joinCoyoneda ≡ proextract