In ReverseState, the result of each computation is threaded left-to-right, and the state is threaded right-to-left. What happens if the set state depends on the computation result? Does that just yield bottom?
More colorfully, in `State RiemannHypothesisProof`, Haskell Scientists begin by reading the state (which comes from the future), pass it along, and then (in the future) set the state, which they received as an input from the past.
If the forward traveling result contains a computation that is dependent on the backward traveling state, and the backward traveling state contains a computation that is dependent on the forward traveling result, and either one is forced to a normal form, then yes, you will get bottom. Otherwise, the computation will terminate.
It is a somewhat common thing to use a 'TardisT' monad (combination of reverse and forward state monads) to write assembler-like things, with fixups. The fixups travel backwards, and the generated code travels forward. This terminates, as long as you never examine the generated code when generating the fixups.
3 comments
[ 4.0 ms ] story [ 20.5 ms ] threadMore colorfully, in `State RiemannHypothesisProof`, Haskell Scientists begin by reading the state (which comes from the future), pass it along, and then (in the future) set the state, which they received as an input from the past.
It is a somewhat common thing to use a 'TardisT' monad (combination of reverse and forward state monads) to write assembler-like things, with fixups. The fixups travel backwards, and the generated code travels forward. This terminates, as long as you never examine the generated code when generating the fixups.