
David F. Place wrote:
So, the next question is: Why isn't this already in Control.Monad?
Some people have proposed it. Part of the reason is all the possible variations (monadic action, monadic test, monadic filter, etc etc), and it's all really very easy to write yourself. Perhaps it's even *enlightening* to write it yourself sometimes, since it gives you practice in writing monadic code and understanding these points :) Maybe another part of the reason is that supplying people with a fixed list of 'imperative-style' combinators makes them think that that's all there is, and struggle when they need something more complex because they aren't really sure how to use the 'lower-level' building blocks. Still, I think there is still room for someone to suggest a really top-notch list of 'imperative-style-monadic' combinators. Jules