[<<][rtl][>>][..]
Mon Jun 18 10:23:50 EDT 2018

Stacking monads

As a user interface, it is probably possible to stack another StateT.
But how to do that without interference?

It's not a problem to stack multiple I believe.  I think it will just
pick the first one it finds.  So that would be from the user's
perspective.  But how to "tag" the inner state monad used in the
emulator?

To make this work properly, it is probably best to all put it into one
monad.  But how to solve the problem of multiple isolated states?
This has to be a problem people have run into before.


http://blog.ezyang.com/2013/09/if-youre-using-lift-youre-doing-it-wrong-probably/

    As everyone is well aware, when a monad transformer shows up
    multiple times in the monad stack, the automatic type class
    resolution mechanism doesn't work


EDIT: Maybe time to simplify.  The reader monad isn't really
necessary, so take the current parameterization to be an extra
component to the state monad.

EDIT: Looks like the writer monad is already gone.


How does this compose?  I want to be able to add an effect
transparently.  It seems the only way to really do that is to use
existential types.

Say there is a "fixReg" operator for each kind of state, which will
add a state element to a list and record a way to access it.

Added a list of existential state types.  Next is to find a way to
separate the "allocate" and "use" phases, in a way that is similar to
a register.

Maybe this thing could be just an extension of a register?  That
actually makes more sense.  EDIT: So I made some room for this. Now what?

EDIT: Can't be just made of registers, because those get initialized
on every tick, so is definitely different form a register.

The interface should be "a special kind of register".  That way, IO
can be modeled as registeres as well.

Now fixMem can be implemented using an analogue to "signal",
e.g. "memory", to create a register that holds e.g. a Map, or some
other state structure.




[Reply][About]
[<<][rtl][>>][..]