
Adrian Hey
On Mon 27 Nov, Fergus Henderson wrote:
Do you think that Haskell would be better without `unsafePerformIO'?
Well, a sceptic like me is bound to wonder why such a non-function is provided in a purely functional language. What really worries me is that the damage isn't localised. If you allow such things you can never be sure that any function really is a function, without careful scrutiny of all the code it's dependent on.
Consider `unsafePerformIO' to be a feature to implement system libraries and the like. It makes it easier to implement libraries in Haskell which otherwise partially or completely would have to be written in another language and, then, be called from Haskell. Like with any system library if the system programmer messes it up (eg, exports a function that isn't really a function), you are in for some trouble. This is not very different to you trusting the interpreter or compiler implementer that what they execute is actually what you wrote. Cheers, Manuel