Yes, in that case it would just be the state monad applied twice.

But it is here, I think, that switching from the terminology “reader”, “writer”, “state” to “randomness” becomes really compelling:

on non-linear type then reader and writer will almost never coincide.

On stable linear types however, there are interesting situations in which “reader” and “writer” coincide (namely if $W$ is “compact enough” such as to admit a Poincaré duality), but in this situation is interpretation in terms of “reading” and “writing” is maybe no longer the most immediate one (though in principle it still applies). The more immediate interpretation of what is going on in this case is that one is producing linear spaces of probability amplitudes.

]]>Then the state monad passes through

$\ast \leftarrow W \stackrel{id}{\rightarrow} W \rightarrow \ast \leftarrow W \rightarrow \ast \rightarrow \ast.$What’s happening when reader and writer coincide? In that situation does it make sense to form a state monad which will just be reader (or writer) applied twice?

]]>…and we’re in the realm of path integrals. Does anything interesting happen in the relative case $W_0 \leftarrow W \rightarrow W_0$?

This relative case is already what matters for the path integral here.

In this context we are to think of the “possible worlds” more concretely as the “possible paths” or “possible trajectories” that a physical system may traverse. These are regarded here as depending on one of their two endpoints. “All possible histories $w(w_0) \in W(w_0)$ starting at the world $w_0 \in W_0$.”

]]>So the writer comonad is a pull-push transform for the span $\ast \leftarrow W \rightarrow \ast$.

You said somewhere that reader and writer agree in certain contexts. Ah yes here. So there the randomness of the reader combines with the pull-pushnness of the writer, and we’re in the realm of path integrals.

Does anything interesting happen in the relative case $W_0 \leftarrow W \rightarrow W_0$? In modal terms this was supposed to be about a less than total accessibility relation on worlds. Does one ever pull-push through an equivalence relation?

]]>started a minimum at *writer comonad*