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

David F. Place d at vidplace.com
Wed Mar 21 09:00:15 EDT 2007


On Mar 21, 2007, at 8:40 AM, Jules Bean wrote:

> 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.

Indeed, I had just written

whileM_ p a = do cond <- p ; if cond then do a ; whileM_ p a else  
return ()

I always wonder, when I have to do such things, if I just haven't  
studied the libraries well enough.

   ___________________
(---o-------o-o-o---o-o-o----(
David F. Place
mailto:d at vidplace.com




More information about the Haskell-Cafe mailing list