Continuations can work here, but they're way overkill. In fact, continuations are almost always overkill for solving any specific problem.
The simplest solution is to put the necessary logic into your Eval
type. If you make Eval
contain a constructor for "this computation returned early with this value", and then make your definitions of (>>)
and (>>=)
respect that, everything will work out automatically.