I have been reading about unsafePerformIO
lately, and I would like to ask you something. I'm OK with the fact that a real language should be able to interact with the external environment, so unsafePerformIO
is somewhat justified.
However, at the best of my knowledge, I'm not aware of any quick way to know whether an apparently pure (judging from the types) interface/library is really pure without inspecting the code in search for calls to unsafePerformIO
(documentation could omit to mention it).
I know it should be used only when you're sure that referential transparency is guaranteed, but I would like to know about it nevertheless.
unsafePerformIO
to interact with the external environment is exactly what you're not allowed to do. All the effects are supposed to be internal to your code — things like using a mutable variable behind the scenes to implement memoisation. – Gwennie