Well I need to say that I decided to stay with the parser monad. I had three reasons:
- Having refactored the monadic parser it is pretty readable and looks as good as yacc syntaxes I've wrote. In any case it is no longer worse.
- I learned a few new tricks during this refactoring that were fundamental "monadic" tricks. As this is much of an educational exercise, sticking with the monadic parser will teach me more.
- Monads have a differential relation to lambda calculus and "equational" relations are the theme of this blog!