In the case you are thinking about, using unsafePerformIO unjustified. The documentation for unsafePerformIO explains this: it is intended only for cases where the developer can prove that it is not possible to break link transparency , i.e. "purely functional" semantics. If someone uses unsafePerformIO in such a way that a purely functional program can detect it (for example, write a function whose result depends not only on its arguments), then this is forbidden use.
If you encounter such a case, most likely you have found an error.
Luis casillas
source share