On Thursday, February 13, 2003 8:33 AM, Arjan van IJzendoorn 
[SMTP:[EMAIL PROTECTED]] wrote:
> Not with the syntactic sugar of 'if'.
> But you can write [warning: untested code ahead]
>
> ifM :: IO Bool -> IO a -> IO a -> IO a
> ifM test yes no = do
>    b <- test
>    if b then yes else no

I had

ifM :: Monad m => m Bool -> m a -> m a -> m a
ifM tst thn els =
  do b <- tst
     if b then thn else els

And I just tested it.

----
Kevin S. Millikin      Architecture Technology Corporation
Research Scientist     Specialists in Computer Architecture
[EMAIL PROTECTED]   http://www.atcorp.com


_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to