unsafePerformIO

Simon Peyton-Jones simonpj@microsoft.com
Tue, 24 Sep 2002 09:04:26 +0100


The actions performed by unsafePerformIO are simply done at some
entirely unpredictable time, perhaps interleaved with actions on the
main execution path.=20

The formal semantics in the notes doesn't have a good way to express
that because the purely-functional part is given a denotational
semantics... yet unsafePerformIO can occur in the middle of that.

So it's tiresome to characterise in theory, and hard to predict in
practice.  You should only use it when the state it is fiddling with is
well partitioned.


Simon

| -----Original Message-----
| From: David Sabel [mailto:dsabel@stud.uni-frankfurt.de]
| Sent: 20 September 2002 13:48
| To: Simon Peyton-Jones; glasgow-haskell-users@haskell.org
| Subject: unsafePerformIO
|=20
| In read your paper ""Tackling the Awkward Squad: monadic input /
output,
| concurrency, exceptions, and foreign-language calls in Haskell",  and
have
| a question about unsafePerformIO.
|=20
| In your operational semantic of the IO-Monad you tell nothing about,
how
| 'unsafe' IO actions are performed, is there another paper /
documentation
| about
| this available, or can you - or someone else - give me a review about
that?
|=20
| David
| JWGU Frankfurt
|=20