Writing the definitions in one go doesn't seem to work yet. Maybe
it's time to try one thing at a time.
I.e. start from the continuation monad, and try to express some CPS
code in it. The state monad part doesn't seem to be the problem.