Hi, I have an question about the IO monad I want to have a function that unpack an IO. I should have the type: IO a -> a. Is this possible? Kind regards Tom Hofte
On Fri, Jun 11, 2004 at 01:23:11PM +0200, Tom Hofte wrote:
I want to have a function that unpack an IO. I should have the type: IO a -> a. Is this possible?
There is unsafePerformIO, but before you use it, think - do you really, really want to use it and you really, really know what the consequences can be? Perhaps you could tell us what it is that you think you need unsafePerformIO for? Maybe it can be done without it? Best regards, Tom -- .signature: Too many levels of symbolic links
Tom Hofte writes (to the Haskell mailing list):
I want to have a function that unpack an IO. I should have the type: IO a -> a. Is this possible?
Tomasz Zielonka replies:
There is unsafePerformIO, but before you use it, think [..]
See also <http://www.haskell.org/hawiki/ThatAnnoyingIoType>. Cheers, Ronny Wichers Schreur
On Fri, Jun 11, 2004 at 01:23:11PM +0200, Tom Hofte wrote:
I want to have a function that unpack an IO. I should have the type: IO a -> a. Is this possible?
There is unsafePerformIO, but before you use it, think - do you really, really want to use it and you really, really know what the consequences can be? Perhaps you could tell us what it is that you think you need unsafePerformIO for? Maybe it can be done without it?
It really should be a list Rule that we don't mention unsafePerformIO to newbies. It should be obvious from the post that unsafePerformIO is *not* what the poster wants, so telling them about it will just confuse them. The wiki pointer is much more useful. (and the ghost of Launchbury whispers in my ear that this is the Haskell list, and "unsafePerformIO is not Haskell"!). --KW 8-)
On 11 Jun 2004, at 08:50, Keith Wansbrough wrote:
On Fri, Jun 11, 2004 at 01:23:11PM +0200, Tom Hofte wrote:
I want to have a function that unpack an IO. I should have the type: IO a -> a. Is this possible?
There is unsafePerformIO, but before you use it, think - do you really, really want to use it and you really, really know what the consequences can be? Perhaps you could tell us what it is that you think you need unsafePerformIO for? Maybe it can be done without it?
It really should be a list Rule that we don't mention unsafePerformIO to newbies. It should be obvious from the post that unsafePerformIO is *not* what the poster wants, so telling them about it will just confuse them. The wiki pointer is much more useful.
(and the ghost of Launchbury whispers in my ear that this is the Haskell list, and "unsafePerformIO is not Haskell"!).
John is dead?!?!?! I guess it's obvious now that someone has implied it. It's seems that every time he's seen me of late, he wore an expression of great pain, bordering on a rictus. Further, consider that not one of the Galois ( http://www.galois.com ) pages has a photo of him and his OGI page ( http://www.cse.ogi.edu/~jl ) advertises "Warning: This page is out of date". Indeed, on the latter page, his visage lacks any sign of animation. Furthermore, it is a closely guarded secret that Oregonian Oxford Alumni are always interred in their symbolic color, eggplant. Now couple this with the most recent issue of the Onion ( http://www.theonion.com/ ). Notice the second photo in the middle column is obviously a young John Launchbury. (This is clearer in the small picture, the larger one within the article has been discernibly retouched.) The accompanying story is about a young man committing suicide. Coincidence? Or maybe this is all a ploy to boost sales. Those Galois fellows have a reputation for being clever. (Hmm... perhaps Wansbrough is a stock holder?) ---knarF P.S. Perhaps on the Haskell wiki we could start a page along the lines of: http://www.angelfire.com/ct/scrmgdasys/
(and the ghost of Launchbury whispers in my ear that this is the Haskell list, and "unsafePerformIO is not Haskell"!).
John is dead?!?!?!
Not to my knowledge, just not on the mailing list... --KW 8-) -- Keith Wansbrough <kw217@cl.cam.ac.uk> http://www.cl.cam.ac.uk/users/kw217/ University of Cambridge Computer Laboratory.
At 13:23 11/06/04 +0200, Tom Hofte wrote:
Hi,
I have an question about the IO monad
I want to have a function that unpack an IO. I should have the type: IO a -> a. Is this possible?
Possible, but... in addition to other responses, I'd also recommend looking at this: http://www.nomaware.com/monads/html/laws.html#nowayout If you can get computed values out the IO monad, you have the potential to seriously break many things. #g -- ------------ Graham Klyne For email: http://www.ninebynine.org/#Contact
participants (6)
-
Frank Seaton Taylor -
Graham Klyne -
Keith Wansbrough -
Ronny Wichers Schreur -
Tom Hofte -
Tomasz Zielonka