unsafePerformIO safety.

Simon Marlow simonmarhaskell at gmail.com
Wed Mar 7 04:27:26 EST 2007


Lennart Augustsson wrote:
> I wouldn't like if unsafePerformIO could never be inlined, sometimes you 
> want it inlined for performance.
> And not all uses are hacky, it's just that when I use it, then burden is 
> on me to convince myself that it is safe.

unsafePerformIO is currently not inlined - there's a NOINLINE pragma on its 
definition in GHC.IOBase, and some comments in there to explain why.

You're right that sometimes you really want it to be inlined - this is why 
there's a function called inlinePerformIO in Data.ByteString.Base, for example. 
  You'd better really know what you're doing before using that one, though :-)

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list