3 ms·
But TardisT is sequenced in the monadic value. It is not sequenced in its inner backwards-traveling state, but that is not part of the monadic structure. Have
by tathougies 9y ago
But TardisT is sequenced in the monadic value. It is not sequenced in its inner backwards-traveling state, but that is not part of the monadic structure.
Have you used TardisT? In order to use the backwards traveling state, you need to bind the state syntactically before you use it, just as you have to do with the forwards traveling state.
For example, a typical setup for TardisT is fixing up jump offsets for an assembler. To write this, you do something like
assembler (Label l) = do
fixup <- getFuture
(curOps, offset) <- getPast
modifyBackwards (M.insert l offset)
let ops = curOps ++ [ Jump (M.lookup l fixup) ]
sendFuture (ops, offset + 1)
assembler ... = ...
Note that both the forwards and backwards traveling state needed to be bound before they were used. There is an inherent 'forwards-traveling' sequencing due to the monadic structure.
If tardist were not monadically sequenced, you ought to be able to do
assembler (Label l) = do
(curOps, offset) <- getPast
let ops = curOps ++ [ Jump (M.lookup l fixup) ]
sendFuture (ops, offset + 1)
fixup <- getFuture
modifyBackwards (M.insert l offset)
In this sense, the forwards traveling state is privileged (and indeed if you write anything sufficiently complicated, you'll note that you'll need to add a lot of lazy pattern matches on the backwards traveling state, but not the forwards traveling one, again indicating a notion of sequencing, despite what it may seem).
- tome 9y agoGood explanation of Tardis, but would you really describe that as "forc[ing] sequencing by creating a data dependency"?
- tathougies 9y agoI would get rid of the forcing part, but I think my example shows it does cause a sequential dependency ?