
On Wednesday, August 13, 2003 11:20 PM, Tn X-10n [SMTP:kawairashii@hotmail.com] wrote:
is it possible to convert IO Bool to Bool?
Sure. Which Bool do you want? True?
toTrue :: IO Bool -> Bool toTrue x = True
Or False?
toFalse :: IO Bool -> Bool toFalse x = False
Maybe that's not what you had in mind.

On Thursday, 2003-08-14, 17:05, CEST, Kevin S. Millikin wrote:
On Wednesday, August 13, 2003 11:20 PM, Tn X-10n [SMTP:kawairashii@hotmail.com] wrote:
is it possible to convert IO Bool to Bool?
Sure. Which Bool do you want? True?
toTrue :: IO Bool -> Bool toTrue x = True
Or False?
toFalse :: IO Bool -> Bool toFalse x = False
I wouldn't call these *conversion* functions because they don't look at their argument.
Maybe that's not what you had in mind.
Surely not. Wolfgang

On Thu, 14 Aug 2003, Wolfgang Jeltsch wrote:
On Thursday, 2003-08-14, 17:05, CEST, Kevin S. Millikin wrote:
On Wednesday, August 13, 2003 11:20 PM, Tn X-10n [SMTP:kawairashii@hotmail.com] wrote:
is it possible to convert IO Bool to Bool?
Sure. Which Bool do you want? True?
toTrue :: IO Bool -> Bool toTrue x = True
Or False?
toFalse :: IO Bool -> Bool toFalse x = False
There's also boolFromIO :: IO Bool -> Bool boolFromIO = boolFromIO if you want to be even less useful :)
I wouldn't call these *conversion* functions because they don't look at their argument.
Maybe that's not what you had in mind.
Surely not.
Wolfgang
I'm surprise nobody has mentioned unsafePerformIO (:: IO a -> a). As the name suggests, it isn't referentially transparent. Are you sure you need a function of type IO Bool -> Bool? What are you trying to do? Brandon

G'day all. On Thu, Aug 14, 2003 at 11:30:11AM -0700, Brandon Michael Moore wrote:
I'm surprise nobody has mentioned unsafePerformIO (:: IO a -> a). As the name suggests, it isn't referentially transparent.
I'm not surprised. First, it's not standard Haskell. Second, people tend not to mention it because you really shouldn't use it unless you know what you're doing. Cheers, Andrew Bromage
participants (4)
-
Andrew J Bromage
-
Brandon Michael Moore
-
Kevin S. Millikin
-
Wolfgang Jeltsch