1. 16

  2. 9

    Worth noting that the ASM monad is “just” WriterT [Word8] ◦ StateT Loc which provides the functor instance, the applicative instance, the monad instance, the MonadWriter instance, the MonadState instance, the MonadFix instance, a MonadTrans instance if the author is interested, and even an Alternative/MonadPlus instance (e.g., the ability to have branching, non-deterministic computation in assembly if we adjoin a failing monad into the stack).

    This is not a critique of anything in the post—it’s just a note that monads (and monad transformers) are really cool! If you know how to recognize monad decompositions like I just did then you can exploit it to read off whole lists of properties and implementations of functions.

    1. 4

      When I first saw this, I thought “Abstract State Machine Monad?”