1 Oct 2002 17:47
Re: IO-System
David Sabel <DavidSabel <at> web.de>
2002-10-01 15:47:43 GMT
2002-10-01 15:47:43 GMT
> > I'm, analysing the IO-system of the GHC and need more > > information about > > it. > > More precisely: How switches the run-time-system between (normal) > > evaluation and performing of IO-actions? > > > > I read the rts-paper, but didn't find any information about this. > > > > Can somebody give a short review, or are ther any other > > papers available? > > The runtime system mostly has no concept of IO vs. non-IO evaluation. > The IO monad is implemented as the following type: > > newtype IO a = IO (State# RealWorld -> > (# State# RealWorld, a #) > > which means that an IO action is simply a function from the world state > to a pair of a new world state and a value. In other words, it's a > straightfoward state monad, except that we use some optimised > representations to eliminate some of the overhead of passing the state > around. > > Cheers, > Simon In the GHC users guide Chapter 7.2.12 is the single primitve value realWorld# of the state of the world provided. This value is also used in the implementation of unsafePerformIO(Continue reading)
-kzm
RSS Feed