I shot for an interpreter of Plain in Haskell, but ended with a compiler from Plain to a STM-like intermediate language (promises and atomic execution - let's call it PAL) and an interpreter for PAL in Haskell (let's call it PVM). This looks promising (pun intended).
What I need to do before going further is:
- Fix implementation of variables in PVM (this is currently a strange hybrid of de Bruijn indices and dynamic scoping).
- Express PAL statements in monadic form to simplify writing compiler(s).
- Express PVM in monadic form to simplify experimenting with it.
- Externalize scheduling (probably in a way of A Language-Based Approach to Unifying Events and Threads). Amusingly, an atomic execution could be elegantly expressed as a strict node in the trace tree.
- Explore possibilities for a type system for PAL (A Functional Abstraction of Typed Contexts?).