In the previous post, I explained how I refactored the language-puppet catalog compiler so that the main monad was a pure Program (from the operational package) instead of an ErrorT Doc (RSST InterpreterReader InterpreterWriter InterpreterState IO) . I then wrote an interpreter that would turn it back to this monad stack, so that it could be used with runErrorT and runRSST .

It might have been obvious to many readers that this was a pretty strange move, but I didn’t figure it out until operational ’s author told me (thanks !). Here is what my interpreter signature was :

1 2 3 interpretIO :: InterpreterReader -> InterpreterMonad a -> ErrorT Doc ( RSST InterpreterReader InterpreterWriter InterpreterState IO ) a

And here is what it should have been from the beginning :

1 2 3 4 interpretIO :: InterpreterReader -> InterpreterState -> InterpreterMonad a -> IO ( Either Doc a , InterpreterState , InterpreterWriter )