kan-extensions-5.2.5: Kan extensions, Kan lifts, the Yoneda lemma, and (co)density (co)monads
Copyright (C) 2011-2016 Edward Kmett
License BSD-style (see the file LICENSE)
Maintainer Edward Kmett <ekmett@gmail.com>
Stability provisional
Portability MPTCs, fundeps
Safe Haskell Trustworthy
Language Haskell2010

Data.Functor.Yoneda

Description

The covariant form of the Yoneda lemma states that f is naturally isomorphic to Yoneda f .

This is described in a rather intuitive fashion by Dan Piponi in

http://blog.sigfpe.com/2006/11/yoneda-lemma.html

Synopsis

Documentation

newtype Yoneda f a Source #

Yoneda f a can be viewed as the partial application of fmap to its second argument.

Constructors

Yoneda

Fields

Instances

Instances details
ComonadTrans Yoneda Source #
Instance details

Defined in Data.Functor.Yoneda

MonadTrans Yoneda Source #
Instance details

Defined in Data.Functor.Yoneda

Methods

lift :: Monad m => m a -> Yoneda m a Source #

( Functor f, MonadFree f m) => MonadFree f ( Yoneda m) Source #
Instance details

Defined in Data.Functor.Yoneda

Methods

wrap :: f ( Yoneda m a) -> Yoneda m a Source #

Monad m => Monad ( Yoneda m) Source #
Instance details

Defined in Data.Functor.Yoneda

Functor ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Methods

fmap :: (a -> b) -> Yoneda f a -> Yoneda f b Source #

(<$) :: a -> Yoneda f b -> Yoneda f a Source #

MonadFix m => MonadFix ( Yoneda m) Source #
Instance details

Defined in Data.Functor.Yoneda

Methods

mfix :: (a -> Yoneda m a) -> Yoneda m a Source #

Applicative f => Applicative ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Foldable f => Foldable ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Traversable f => Traversable ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Distributive f => Distributive ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Representable g => Representable ( Yoneda g) Source #
Instance details

Defined in Data.Functor.Yoneda

Associated Types

type Rep ( Yoneda g) Source #

Eq1 f => Eq1 ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Methods

liftEq :: (a -> b -> Bool ) -> Yoneda f a -> Yoneda f b -> Bool Source #

Ord1 f => Ord1 ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

( Read1 f, Functor f) => Read1 ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Show1 f => Show1 ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Alternative f => Alternative ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

MonadPlus m => MonadPlus ( Yoneda m) Source #
Instance details

Defined in Data.Functor.Yoneda

Comonad w => Comonad ( Yoneda w) Source #
Instance details

Defined in Data.Functor.Yoneda

Plus f => Plus ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Traversable1 f => Traversable1 ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Methods

traverse1 :: Apply f0 => (a -> f0 b) -> Yoneda f a -> f0 ( Yoneda f b) Source #

sequence1 :: Apply f0 => Yoneda f (f0 b) -> f0 ( Yoneda f b) Source #

Alt f => Alt ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Apply f => Apply ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Bind m => Bind ( Yoneda m) Source #
Instance details

Defined in Data.Functor.Yoneda

Foldable1 f => Foldable1 ( Yoneda f) Source #
Instance details

Defined in Data.Functor.Yoneda

Extend w => Extend ( Yoneda w) Source #
Instance details

Defined in Data.Functor.Yoneda

Adjunction f g => Adjunction ( Yoneda f) ( Yoneda g) Source #
Instance details

Defined in Data.Functor.Yoneda

( Eq1 f, Eq a) => Eq ( Yoneda f a) Source #
Instance details

Defined in Data.Functor.Yoneda

( Ord1 f, Ord a) => Ord ( Yoneda f a) Source #
Instance details

Defined in Data.Functor.Yoneda

( Functor f, Read (f a)) => Read ( Yoneda f a) Source #
Instance details

Defined in Data.Functor.Yoneda

Show (f a) => Show ( Yoneda f a) Source #
Instance details

Defined in Data.Functor.Yoneda

type Rep ( Yoneda g) Source #
Instance details

Defined in Data.Functor.Yoneda

type Rep ( Yoneda g) = Rep g

liftYoneda :: Functor f => f a -> Yoneda f a Source #

The natural isomorphism between f and Yoneda f given by the Yoneda lemma is witnessed by liftYoneda and lowerYoneda

liftYoneda . lowerYonedaid
lowerYoneda . liftYonedaid
lowerYoneda (liftYoneda fa) =         -- definition
lowerYoneda (Yoneda (f -> fmap f a)) -- definition
(f -> fmap f fa) id                  -- beta reduction
fmap id fa                            -- functor law
fa
lift = liftYoneda

as a right Kan extension

yonedaToRan :: Yoneda f a -> Ran Identity f a Source #

Yoneda f can be viewed as the right Kan extension of f along the Identity functor.

yonedaToRan . ranToYonedaid
ranToYoneda . yonedaToRanid