unsafePerformIO

Hal Daume III hdaume@ISI.EDU
Fri, 20 Sep 2002 07:42:13 -0700 (PDT)


I'm not sure of a reference, the basic idea is this:

  IO a is represented by the pair (RealWorld, a) (unboxed, really
      but whatever)
  When an IO action is run (via main), a RealWorld state is provided
      by the compiler and passes it around.
  When you do unsafePerformIO, the compiler conjures up some
      value of type RealWorld to use.  It is unsafe because it
      doesn't guarentee the relative order of IO actions.

Of course, someone correct me if I'm mistaken.

 - Hal

--
Hal Daume III

 "Computer science is no more about computers    | hdaume@isi.edu
  than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume

On Fri, 20 Sep 2002, David Sabel wrote:

> 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.
> 
> 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?
> 
> David
> JWGU Frankfurt
> 
> 
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users@haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>