[<<][rtl][>>][..]
Mon May 28 14:32:50 EDT 2018

Memories

So basic structure is there.  How to actually use it?

Memories are an implementation feature.  Generally we will provide
code that is parameterized by the memory's register interfaces.

Test it with a dummy read/write.

So it's the same as general register fix: close over the memory
interface.


-- Dummy memory-using operation.  For testing memFix.
dummy_mem rd = do     -- mem reg in
  z <- int 0
  return ((z, z, z),  -- mem regs out
          [z])        -- test program output


Maybe this can be added to Seq?  It's very useful to have without the
need of pushing memFix in as a paremeter.

So I have a test, but no generic way to do this.

The problem is that the interfaces changes with all this threading
going on.

It would be more convenient to tuck it into the monad.

I want a "makeMemory" function.

dummy_mem rd = do     -- mem reg in
  z <- int 0
  return ((z, z, z),  -- mem regs out
          [z])        -- test program output

dummy_mem2 makeMem = do
  memFix <- makeMem
  [o] <- memFix (t, t) dummy_mem
  return $ o


How to do this without parameterizing the class?

Memory is a general case of external I.O.  I want a generic way to
embed abstract state threading.

There are two ways:
- Find a way to hide it into the main monad
- Use custom trace functions

The latter really doesn't seem like a good idea.

I think this is a job for existential types.




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