Re: [Haskell-cafe] Pesky monads...

2007-05-19 Thread Matthew Cox
else f x >>= untilM pred f Think of a computation in the State monad, a predicate will probably want to consult that state. Matthew Cox ----- Original Message - From: Matthew Cox To: Sent: Sat, 19 May 2007 13:10:40 -0600 Subject: Re: [Haskell-cafe] Pesky monads... You can define one:

Re: [Haskell-cafe] Pesky monads...

2007-05-19 Thread Matthew Cox
You can define one: untilM :: Monad m => (a -> Bool) -> (a -> m a) -> a -> m a untilM pred f x | pred x = return x | otherwise = f x >>= untilM pred f Matthew Cox - Original Message - From: Andrew Coppin To: haskell-cafe@haskell.org Sent: S