profunctors-5.6.2: 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 | Trustworthy
Language | Haskell2010

Data.Profunctor.Yoneda

Description

Synopsis

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

# Documentation

newtype Yoneda (p :: Type -> Type -> Type) a b #

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

Instances details

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

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

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

duplicateYoneda :: forall (p :: Type -> Type -> Type) a b. Yoneda p a b -> Yoneda (Yoneda p) a b #

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

data Coyoneda (p :: Type -> Type -> Type) a b where #

Constructors

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

#### Instances

Instances details

ProfunctorComonad Coyoneda # |
Instance details Defined in Data.Profunctor.Yoneda Methods proextract :: forall (p :: Type -> Type -> Type). Profunctor p => Coyoneda p :-> p # produplicate :: forall (p :: Type -> Type -> Type). Profunctor p => Coyoneda p :-> Coyoneda (Coyoneda p) #
ProfunctorMonad Coyoneda # |
Instance details Defined in Data.Profunctor.Yoneda Methods proreturn :: forall (p :: Type -> Type -> Type). Profunctor p => p :-> Coyoneda p # projoin :: forall (p :: Type -> Type -> Type). Profunctor p => Coyoneda (Coyoneda p) :-> Coyoneda p #
ProfunctorFunctor Coyoneda # |
Instance details Defined in Data.Profunctor.Yoneda Methods promap :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type). Profunctor p => (p :-> q) -> Coyoneda p :-> Coyoneda q #
(Category p, Profunctor p) => Category (Coyoneda p :: Type -> Type -> Type) # |
Instance details Defined in Data.Profunctor.Yoneda Methods id :: Coyoneda p a a # (.) :: Coyoneda p b c -> Coyoneda p a b -> Coyoneda p a c #
Choice p => Choice (Coyoneda p) # |
Instance details Defined in Data.Profunctor.Yoneda Methods left' :: Coyoneda p a b -> Coyoneda p (Either a c) (Either b c) # right' :: Coyoneda p a b -> Coyoneda p (Either c a) (Either c b) #
Cochoice p => Cochoice (Coyoneda p) # |
Instance details Defined in Data.Profunctor.Yoneda Methods unleft :: Coyoneda p (Either a d) (Either b d) -> Coyoneda p a b # unright :: Coyoneda p (Either d a) (Either d b) -> Coyoneda p a b #
Closed p => Closed (Coyoneda p) # |
Instance details Defined in Data.Profunctor.Yoneda Methods closed :: Coyoneda p a b -> Coyoneda p (x -> a) (x -> b) #
Mapping p => Mapping (Coyoneda p) # |
Instance details Defined in Data.Profunctor.Yoneda Methods map' :: Functor f => Coyoneda p a b -> Coyoneda p (f a) (f b) # roam :: ((a -> b) -> s -> t) -> Coyoneda p a b -> Coyoneda p s t #
Costrong p => Costrong (Coyoneda p) # |
Instance details Defined in Data.Profunctor.Yoneda Methods unfirst :: Coyoneda p (a, d) (b, d) -> Coyoneda p a b # unsecond :: Coyoneda p (d, a) (d, b) -> Coyoneda p a b #
Strong p => Strong (Coyoneda p) # |
Instance details Defined in Data.Profunctor.Yoneda Methods first' :: Coyoneda p a b -> Coyoneda p (a, c) (b, c) # second' :: Coyoneda p a b -> Coyoneda p (c, a) (c, b) #
Traversing p => Traversing (Coyoneda p) # |
Instance details Defined in Data.Profunctor.Yoneda Methods traverse' :: Traversable f => Coyoneda p a b -> Coyoneda p (f a) (f b) # wander :: (forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t) -> Coyoneda p a b -> Coyoneda p s t #
Profunctor (Coyoneda p) # |

Instance details

Defined in Data.Profunctor.Yoneda

Methods

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

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

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

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

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

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

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

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

joinCoyoneda :: forall (p :: Type -> Type -> Type) a b. Coyoneda (Coyoneda p) a b -> Coyoneda p a b #

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