IO Bool -> Bool

Ashley Yakeley ashley@semantic.org
Sun, 24 Aug 2003 05:12:48 -0700


In article <Law11-F6531bTVn2AI30005073f@hotmail.com>,
 "Tn X-10n" <kawairashii@hotmail.com> wrote:

> is it possible to convert IO Bool to Bool?

Not directly in Haskell, but you can use the "<-" syntax to do something 
vaguely similar inside a "do" block. For instance:

  foo :: IO Bool

  do
    result <- foo
    if result then putStrLn "yes" else return ()

Here "result" has type Bool. "do" blocks are magic conjured from sugar 
and syntax.

-- 
Ashley Yakeley, Seattle WA