IO-System

Simon Marlow simonmar@microsoft.com
Tue, 1 Oct 2002 17:02:31 +0100


> 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
> (GHC.IOBase), where it is applied as the argument
> to the IO action, and so on (after performing the action it's=20
> discarded).
>=20
> My question is now: Is the same value (realWorld#) applied while using
> normal monadic - not unsafe - IO, more precisely
> is a programm main::IO () executing the expression (main realWorld#)?

In effect, yes.  However, the implementation optimises away the actual
values of type State#, so that no actual argument passing goes on most
of the time.

Cheers,
	Simon