[Haskell-cafe] Re: unsafePerformIO: are we safe?

Simon Marlow simonmarhaskell at gmail.com
Tue Oct 9 06:35:51 EDT 2007


Jorge Marques Pelizzoni wrote:
> Hi, all!
> 
> This is a newbie question: I sort of understand what unsafePerformIO does
> but I don't quite get its consequences. In short: how safe can one be in
> face of it? I mean, conceptually, it allows any Haskell function to have
> side effects just as in any imperative language, doesn't it? Doesn't it
> blow up referential transparency for good? Is there anything intrinsic to
> it that still keeps Haskell "sound" no matter what unsafePerformIO users
> do (unlikely) or else what are the guidelines we should follow when using
> it?

Old thread, but I don't think anyone mentioned this text from the GHC FAQ:

http://haskell.org/haskellwiki/GHC:FAQ#When_is_it_safe_to_use_unsafe_functions_such_as_unsafePerformIO.3F

Cheers,
	Simon


More information about the Haskell-Cafe mailing list