Guaranteed to boil your brain: do notation in Ruby. You got your monads in my Ruby! He uses ParseTree and Ruby2Ruby to rewrite your code. In other words: heavy.
I’d love to point you to a good monads tutorial, but the monad fallacy prevents me from doing that. I’ll try again once I fully grok them.