kan-extensions-5.2.7: Kan extensions, Kan lifts, the Yoneda lemma, and (co)density (co)monads

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

Data.Functor.Contravariant.Coyoneda

Description

The co-Yoneda lemma for presheafs states that `f` is naturally isomorphic to ``Coyoneda` f`.

Synopsis

- data Coyoneda (f :: Type -> Type) a where
  - Coyoneda :: forall a b (f :: Type -> Type). (a -> b) -> f b -> Coyoneda f a
- liftCoyoneda :: f a -> Coyoneda f a
- lowerCoyoneda :: Contravariant f => Coyoneda f a -> f a
- hoistCoyoneda :: (forall a. f a -> g a) -> Coyoneda f b -> Coyoneda g b

# Documentation

data Coyoneda (f :: Type -> Type) a where Source #

A `Contravariant` functor (aka presheaf) suitable for Yoneda reduction.

http://ncatlab.org/nlab/show/Yoneda+reduction

Constructors

Coyoneda :: forall a b (f :: Type -> Type). (a -> b) -> f b -> Coyoneda f a |

#### Instances

Instances details

Representable f => Representable (Coyoneda f) Source # |

Instance details

Defined in Data.Functor.Contravariant.Coyoneda

Associated Types

type Rep (Coyoneda f) |
Instance details Defined in Data.Functor.Contravariant.Coyoneda type Rep (Coyoneda f) = Rep f

Methods

tabulate :: (a -> Rep (Coyoneda f)) -> Coyoneda f a Source #

index :: Coyoneda f a -> a -> Rep (Coyoneda f) Source #

contramapWithRep :: (b -> Either a (Rep (Coyoneda f))) -> Coyoneda f a -> Coyoneda f b Source #

Contravariant (Coyoneda f) Source # |
Instance details Defined in Data.Functor.Contravariant.Coyoneda Methods contramap :: (a' -> a) -> Coyoneda f a -> Coyoneda f a' Source # (>$) :: b -> Coyoneda f b -> Coyoneda f a Source #
Adjunction f g => Adjunction (Coyoneda f) (Coyoneda g) Source # |
Instance details Defined in Data.Functor.Contravariant.Coyoneda Methods unit :: a -> Coyoneda g (Coyoneda f a) Source # counit :: a -> Coyoneda f (Coyoneda g a) Source # leftAdjunct :: (b -> Coyoneda f a) -> a -> Coyoneda g b Source # rightAdjunct :: (a -> Coyoneda g b) -> b -> Coyoneda f a Source #
type Rep (Coyoneda f) Source # |
Instance details Defined in Data.Functor.Contravariant.Coyoneda type Rep (Coyoneda f) = Rep f

liftCoyoneda :: f a -> Coyoneda f a Source #

Coyoneda "expansion" of a presheaf

    liftCoyoneda . lowerCoyoneda ≡ id
    lowerCoyoneda . liftCoyoneda ≡ id

lowerCoyoneda :: Contravariant f => Coyoneda f a -> f a Source #

Coyoneda reduction on a presheaf

hoistCoyoneda :: (forall a. f a -> g a) -> Coyoneda f b -> Coyoneda g b Source #

Lift a natural transformation from `f` to `g` to a natural transformation from `Coyoneda f` to `Coyoneda g`.