I can’t really claim any credit for this Lambda-calculus-interpreting Haskell snippet, as it’s more or less directly ripped off from Wadler’s The Essence of Functional Programming. The only change I’ve made is to update the syntax so that it uses the current Haskell
do notation for monads instead of
unitM. Doing that was enough to enable me to persuade myself that I understood the code.
What would be cool would be to equip this with a parser, a REPLoop and the ability to
setq values within the top-level environment. The macho thing to do here would be to try to get from there to a complete Scheme interpreter or something like that. Then at last I’d be a real boy, and my nose would stop getting longer every time I pretended to know something about programming language theory.