
21 Mar
2007
21 Mar
'07
8:18 a.m.
Interesting, but what if 'p' is also a monadic action? For instance, it might access the state of the State monad which 'f' is updating. On Mar 21, 2007, at 5:31 AM, Jules Bean wrote:
..but here 'f' is a pure function, not a monadic action. If you want f to be a monadic action then you want:
*Main> :t let untilM p f x = if p x then return x else untilM p f =<< f x in untilM let untilM p f x = if p x then return x else untilM p f =<< f x in untilM :: (Monad m) => (a -> Bool) -> (a -> m a) -> a -> m a
___________________ (---o-------o-o-o---o-o-o----( David F. Place mailto:d@vidplace.com