There is this observation (worldpress blog) that the continuation monad (Wikipedia) stems from the Yoneda embedding.
For fixed data types $R$, the monad maps data types $T$ to types $(T\to R)\to R$. The "realization" (return/unit) is given the map sending $t$ to the continuation $f_{tr}\mapsto f_{tr}(t)$.
I worked out a sketch on how the correspondence works and I would like some guidance in the category theoretical formalizations - in particular I'd like to know where the manipulations I do work, and if I'm on the right track. How I think it goes:
Yoneda gives
$\mathrm{Hom}(S,T)\to\mathrm{nat}(\mathrm{Hom}(T,-),\mathrm{Hom}(S,-))$
Let's fix an object $R$ in place of $-$ and also write $\to$ for $\mathrm{nat}$, as e.g. Haskell (MO question to Yoneda in Haskell) has only (possibly polymorphic) functions. So that's
$(S\to T)\to((T\to R)\to(S\to R)).$
Now I work towards the return function, i.e. the unit of the monad: By
$\mathrm{Hom}(R^T,R^S)\cong\mathrm{Hom}(S\times R^T,R)\cong\mathrm{Hom}(S,\mathrm{Hom}(R^T,R)),$
this is the same as
$(S\to T)\to(S\to(T\to R)\to R)$
We can find a map of this type, namely map $f_{st}$ to the map sending $s$ to to the continuation $f_{tr}\mapsto f_{tr}(f_{st}(s))$.
In particular, for $S=T$ and $f_{st}\equiv \mathrm{id}$, we get the map sending $t$ to the continuation $f_{tr}\mapsto f_{tr}(t)$.
Is this about right? I'm a little unsure about my manipulations involving the hom-set $\mathrm{nat}$ in the functor category.
My question of interest would then be what the requirements for the original category are, so that I actually get through with the explicit "realization" on the function level?
What is the monad object action as in programming (the map from $T$ to $(T\to R)\to R$) in the category theoretical interpreation?
Lastly, in which categories to I get to the map $f_{tr}\mapsto f_{tr}(f_{st}(s))$ and to the final construction of the continuation.