Yoneda - Category Theory

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

TheMatten

Trying to get intuition on Yoneda Lemma - is this proper specialization to Hask?:

newtype f ~> g = Nat{ ($~) :: forall x. f x -> g x }
data a <-> b = Iso{ from :: a -> b, to :: b -> a }

yoneda :: Functor f => ((->) a ~> f) <-> f a
yoneda = Iso ($~ id) (\fa -> Nat (<$> fa))
Vincent L

Is there an example of how to use Yoneda Lemma in Haskell ? I always saw is used in proof for category theory but not used in the context of programming language.