runState -package:linear-base package:extensible-effects

Run a State effect
Run a State effect
A different representation of State: decomposing State into mutation (Writer) and Reading. We don't define any new effects: we just handle the existing ones. Thus we define a handler for two effects together.
A different notion of backwards is realized if we change the Put handler slightly. How? Another implementation, exploring Haskell's laziness to make putAttr also technically inherited, to accumulate the sequence of updates. This implementation is compatible with deep handlers, and lets us play with different notions of backwardness.
Backwards state The overall state is represented with two attributes: the inherited getAttr and the synthesized putAttr. At the root node, putAttr becomes getAttr, tying the knot. As usual, the inherited attribute is the argument (i.e., the environment) and the synthesized is the result of the handler |go| below.
A different representation of State: decomposing State into mutation (Writer) and Reading. We don't define any new effects: we just handle the existing ones. Thus we define a handler for two effects together.