Very interesting read, especially with respect to rewriting source code.<p>One reason why monadic control flow works so well in Haskell is because the sugar and implementation are completely decoupled.  The sugar layer simply rewrites "do { x &#60;- foo; bar x }" to "foo &#62;&#62;= \x -&#62; bar x".  Very easy to do and undo, and it provides no semantics of its own; the transformed and untransformed versions are exactly equivalent.  The actual control of the control flow is in the &#62;&#62;= function, and function calls are very easy to reason about compared to arbitrary source code rewriting.  You are, after all, just passing some data to a function, which returns a result, which is passed to another function.<p>Simple and powerful.<p>This is hard to do in Ruby and Perl because code depends too much on the code(+); control flow is not function applications, it's a magic oracle that looks at the text of your program and uses that as a guide on what to do next.  This makes modifying the control flow difficult; you have to understand the text, and then use that understanding to transform the text, which almost requires you to be as clever as the magical oracle itself.  The end result is something that works really well... until something that the transformer didn't expect happens, and then you are SOL until you can find enough cleverness to work around that problem.  Repeat until your rewriter is essentially a compiler for its own special programming language.<p>(+) Example: "my $foo; $foo = 42" compiles, "my $foo;" compiles, but "$foo = 42" does not compile.  "$foo = 42" is only valid code in the presence of a "my $foo" somewhere before it.  Hard to reason about!