
On Thursday 14 August 2003 06:20, Tn X-10n wrote:
<html><div style='background-color:'><DIV> <P><BR>hai guys</P>is it possible to convert IO Bool to Bool?</DIV></div><br clear=all><hr>Get 10mb of e-mail space with <a href="http://g.msn.com/8HMTENSG/2737??PS=">MSN Hotmail Extra Storage</a> at only S$36 per year including GST</html>
It makes no sense to convert an IO Bool to a Bool. If something has type IO Bool that means it is an action which will get a Bool from the outside world. It cannot be converted into a Bool. If you want to use the action to get a Bool from the outside world you should invoke the action in somewhere in the IO part of your code, like this.. do ... boolVal <- ioBoolAction ... Regards -- Adrian Hey

On Thursday, 2003-08-14, 07:20, CEST, Tn X-10n wrote:
hai guys
is it possible to convert IO Bool to Bool?
No. The reason for introducing the IO type is to preserve the purity of Haskell, i.e., to ensure that expression evaluation doesn't depend on the state of the outside world and doesn't alter this state.*) Allowing a conversion from IO t to t would nullify this. As you might have noticed, there was (or still is) a discussion about "yet another monad tutorial" on The Haskell Cafe. Some of the messenges and, above all, the monad tutorial itself may help you understand how I/O in Haskell works. There is not a quick answer to your question like: "This way you convert an IO Bool to a Bool." You will have to do some reading to understand the basic ideas of I/O in Haskell. They are quiet different from what you might know from other programming languages. Wolfgang *) This is at least how I would formulate it, others would probably phrase it a bit different. ;-) P.S.: Would you mind to configure your mail client such that your mails also contain a plain text variant of your message?

<P><BR>hai guys</P>is it possible to convert IO Bool to Bool?
No, it's not... and for good reason! See the discussion at
http://www.haskell.org/hawiki/ThatAnnoyingIoType
and
http://www.haskell.org/hawiki/UsingIo
In general, the HaWiki has answers to lots of "newbie" questions like
this - you might find it useful to peruse (although you should
certainly continue to ask questions here too - we're a pretty friendly
bunch!).
Best wishes,
--KW 8-)
--
Keith Wansbrough

On Thu, 14 Aug 2003 13:20:05 +0800
"Tn X-10n"
hai guysis it possible to convert IO Bool to Bool?
Read the Gentle Introduction. http://www.haskell.org/tutorial/

In article
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
participants (6)
-
Adrian Hey
-
Ashley Yakeley
-
Derek Elkins
-
Keith Wansbrough
-
Tn X-10n
-
Wolfgang Jeltsch