turn off let floating

Simon Marlow simonmar at microsoft.com
Fri Apr 30 10:37:57 EDT 2004


On 29 April 2004 10:17, David Sabel wrote:

>> You could try out that theory by copying the definition of
>> unsafePerformIO into your code, and putting an INLINE pragma on it. 
>> I think it's safe to do this in your case (it's not safe in general).
> 
> That's interesting for me, in which situations isn't it safe to inline
> the definition of unsafePerformIO?

We try to maintain the invariant that the IO action that is the argument
to unsafePerformIO is atomic, in the sense that it is either completely
performed or not performed when the application of unsafePerformIO is
evaluated (ignoring exceptions).  If we let the compiler inline
unsafePerformIO, then the compiler would sometimes be able to share part
of the IO computation amongst multiple instances, because it can see
that the first action is applied to the realWorld# constant.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list