typed continuation monad (a little mess now)