Sun Mar 14 10:26:07 CET 2010

The Simulator

3 architectual elements:

    - logic gates: Logic typeclass, parameterized over bit

    - memory/register Mem monad, parameterized over bit

    - opcodes written as Mem a -> Mem a'

The move from a -> a' can represent the mutation.  Mutation can be
encoded in the type.  I.e. it should be possible to maintain the whole
memory history, but at the same time use a fast imperative

So, how to encode mutation in the type?  Essentially this needs a list
(environment) in the type.  Lists can be encoded as tuples.

This is related to automatically "forwarding" monad transformers.

Let's try first to understand the future stage environment
representation in [1].  It seems to be useful for this problem, as we
can get rid of the assignment by using nested-let (see the Scheme
example earlier).

The paper[1] refers to [2]: environment classifiers.  It seems [1] is
a bit too general; I don't need effects.  However, [2] does use a
multi-stage calculus.  I'm confused...  Let's stick to [1].

It doesn't seem that the approach in [1] is very useful, except for
the environment passing idea.

[1] http://okmij.org/ftp/Computation/staging/metafx.pdf
[2] http://www.cs.rice.edu/~taha/teaching/05S/511/papers/popl03.pdf