category-extras-0.53.0: Various modules and constructs inspired by category theory

Portability

portable

Stability

experimental

Maintainer

Edward Kmett <ekmett@gmail.com>

Control.Functor.Yoneda

Description

The Yoneda lemma can be realized as the Kan extension along Identity
However, having this special instance allows us to define Yoneda f as a monad,
comonad, etc. based on whatever properties the base functor has, without
limiting ourselves to what Ran f f can manage.

Performance wise, Yoneda may make your monad more efficient at handling a bunch of
fmaps, while CoYoneda may do the same for a comonad assuming you require a greater than
linear amount of time to fmap over your structure. You can apply each in either role
but the asymptotics will probably not be in your favor.