Tue Jun 19 12:39:53 EDT 2018
Currently, only memories are ExtStates. Wrappers are in place. Now
put this behind an existential interface.
EDIT: So the interface should provide a fix function:
f ExtSTate -> M (f ExtState, o)
Note that it will be hard to commute the f with the existential state.
Unless f goes inside the existential type.
Existential types are really hard to use..
So an abstract state from this perspective is a fix function.
Start with the original fixMem
(Zip f, Traversable f) =>
f SType ->
(f (R S) -> M (f (R S, R S, R S, R S), o)) ->
f MemState -> M (f MemState, o)
What the state _does_ is to implement an interaction that is only
visible at the register level. So the interaction interface needs to
be generalized. Let's use lists for now, then generalize.
([R S] -> M [([R S], o)]) ->
s -> M (s, o)
Basically, the abstract fix function takes an abstract register
interaction, its own hidden state, and produces the result of that
interaction together with the updated hidden state.
There are some complications indeed with the interaction of f and the
Ok it is getting a little complicated to express in the current form,
but the basic idea is simple:
external state interaction is represented as a register interaction
Maybe just build it from the ground up to get to a simpler version
that is working (one memory), then generalize from there?
(i (R S) -> M (o (R S), t)) ->
s -> M (s, t)
Currently I don't know what to do with those i,o parameters, so really
just use flat list. I don't think at that point the structure of the
I/O is really important.
EDIT: Painted into a corner.. I need something to close this loop.
Doesn't really matter what. Some essential element is missing.