A Tardis is the combination of the State monad transformer and the Reverse State monad transformer.

The State monad transformer features a forwards-traveling state. You can retrieve the current value of the state, and you can set its value, affecting any future attempts to retrieve it.

The Reverse State monad transformer is just the opposite: it features a backwards-traveling state. You can retrieve the current value of the state, and you can set its value, affecting any past attempts to retrieve it. This is a bit weirder than its forwards-traveling counterpart, so its Monad instance additionally requires that the underlying Monad it transforms must be an instance of MonadFix.

A Tardis is nothing more than mashing these two things together. A Tardis gives you two states: one which travels backwards (or upwards) through your code (referred to as bw ), and one which travels forwards (or downwards) through your code (referred to as fw ). You can retrieve the current value of either state, and you can set the value of either state. Setting the forwards-traveling state will affect the future, while setting the backwards-traveling state will affect the past. Take a look at how Monadic bind is implemented for TardisT :

m >>= f = TardisT $ \ ~(bw, fw) -> do rec (x, ~(bw'', fw' )) <- runTardisT m (bw', fw) (x', ~(bw' , fw'')) <- runTardisT (f x) (bw, fw') return (x', (bw'', fw''))