[Haskell-cafe] Pesky monads...

Matthew Cox matt at mattcox.ca
Sat May 19 15:10:40 EDT 2007


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 at haskell.org
Sent:  Sat, 19 May 2007 19:49:40 +0100
Subject: [Haskell-cafe] Pesky monads...

I've been getting some pretty weird complaints from the type checker. 
And I just figured out why! Grr...

Is there any function that does the same thing as "until", but in a monad?

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list