Mon, 16 Sep 2002 15:48:43 +0100
> I'm, analysing the IO-system of the GHC and need more=20
> information about
> 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=20
> 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 =3D IO (State# RealWorld ->=20
(# 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