Continuation monad with polymorphic return type

I don’t know what your goal is, but here’s an idea: I’ve thought about doing this:

  1. when you’re evaluating the CPS-term by supplying it with a final continuation, supply one that assigns the final value to a reference and throws an exception.
  2. catch the exception and recover the final value.
  3. this should allow the answer type to be empty, or abstract, or whatever, b/c nobody will ever construct a value of that type.

I haven’t worked this thru, but it seems like it should work.