IO Bool -> Bool
Wolfgang Jeltsch
wolfgang@jeltsch.net
Thu, 14 Aug 2003 09:43:22 +0200
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?