unIO vs. unsafePerformIO

Simon Marlow simonmar@microsoft.com
Fri, 1 Feb 2002 09:55:42 -0000


> What's the difference between unIO and unsafePerformIO? And why is the
> former "safe"? (I would like to apply the same questions to=20
> unsafeIOToST and ioToST)

unIO is an internal function used in GHC's libraries, it is not for
external consumption.  GHC represents the IO type using newtype, and the
unIO function just removes the newtype constructor.  It doesn't actually
"perform" the IO action like unsafePerformIO does.

Cheers,
	Simon