kan-extensions-3.6: Kan extensions, Kan lifts, various forms of the Yoneda lemma, and (co)density (co)monads

Portability MPTCs, fundeps provisional Edward Kmett Trustworthy

Data.Functor.Yoneda

Description

The co-Yoneda lemma states that

`f a` is isomorphic to `(forall r. (a -> r) -> f a)`

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

# Documentation

newtype Yoneda f a Source

Constructors

 Yoneda FieldsrunYoneda :: forall b. (a -> b) -> f b

Instances

 ComonadTrans Yoneda MonadTrans Yoneda (Functor f, MonadFree f m) => MonadFree f (Yoneda m) Monad m => Monad (Yoneda m) Functor (Yoneda f) MonadFix m => MonadFix (Yoneda m) MonadPlus m => MonadPlus (Yoneda m) Applicative f => Applicative (Yoneda f) Foldable f => Foldable (Yoneda f) Traversable f => Traversable (Yoneda f) Alternative f => Alternative (Yoneda f) Comonad w => Comonad (Yoneda w) Distributive f => Distributive (Yoneda f) Keyed f => Keyed (Yoneda f) Zip f => Zip (Yoneda f) ZipWithKey f => ZipWithKey (Yoneda f) Indexable f => Indexable (Yoneda f) Lookup f => Lookup (Yoneda f) FoldableWithKey f => FoldableWithKey (Yoneda f) FoldableWithKey1 f => FoldableWithKey1 (Yoneda f) TraversableWithKey f => TraversableWithKey (Yoneda f) TraversableWithKey1 f => TraversableWithKey1 (Yoneda f) Representable g => Representable (Yoneda g) Plus f => Plus (Yoneda f) Alt f => Alt (Yoneda f) Traversable1 f => Traversable1 (Yoneda f) Foldable1 f => Foldable1 (Yoneda f) Apply f => Apply (Yoneda f) Bind m => Bind (Yoneda m) Extend w => Extend (Yoneda w) Monad m => MonadSpec (Yoneda m) Adjunction f g => Adjunction (Yoneda f) (Yoneda g) Eq (f a) => Eq (Yoneda f a) Ord (f a) => Ord (Yoneda f a) (Functor f, Read (f a)) => Read (Yoneda f a) Show (f a) => Show (Yoneda f a)

liftYoneda :: Functor f => f a -> Yoneda f aSource

maxF :: (Functor f, Ord (f a)) => Yoneda f a -> Yoneda f a -> Yoneda f aSource

minF :: (Functor f, Ord (f a)) => Yoneda f a -> Yoneda f a -> Yoneda f aSource

maxM :: (Monad m, Ord (m a)) => Yoneda m a -> Yoneda m a -> Yoneda m aSource

minM :: (Monad m, Ord (m a)) => Yoneda m a -> Yoneda m a -> Yoneda m aSource