[Haskell-cafe] How do I do conditional tail recursion in a monad?

Jules Bean jules at jellybean.co.uk
Wed Mar 21 08:40:45 EDT 2007

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.


More information about the Haskell-Cafe mailing list