I don’t know what your goal is, but here’s an idea: I’ve thought about doing this:
- 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.
- catch the exception and recover the final value.
- 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.