[Haskell-cafe] unsafePerformIO: are we safe?

Sebastian Sylvan sebastian.sylvan at gmail.com
Wed Sep 26 11:28:33 EDT 2007


On 26/09/2007, Jorge Marques Pelizzoni <jpeliz at icmc.usp.br> 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?
>

Rule of thumb: If your name isn't Simon*, you shouldn't use unsafePerformIO.


*
http://research.microsoft.com/~simonpj/
https://research.microsoft.com/~simonmar/


-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862


More information about the Haskell-Cafe mailing list