[Haskell-cafe] What unsafeInterleaveIO is unsafe

Ketil Malde ketil at malde.org
Tue Mar 17 07:59:17 EDT 2009

Duncan Coutts <duncan.coutts at worc.ox.ac.uk> writes:

>> [..] I have a sneaking suspicion [exceptions] actually *is* `unsafe'.  Or, at
>> least, incapable of being given a compositional, continuous semantics.

> Basically if we can only catch exceptions in IO then it doesn't matter,
> it's just a little extra non-determinism and IO has plenty of that
> already.

Couldn't you just substitute "catch exceptions" with "unsafePerformIO"
here, and make the same argument?

Similarly, can't you emulate unsafePerformIO with concurrency?

Further, couldn't you, from IO, FFI into a function that examines the
source code of some pure function, thus being able to differentiate
funcitions that are normally "indistinguishable"?

I've tried to follow this discussion, but I don't quite understand
what's so bad about unsafeInterleaveIO - or rather, what's so uniquely
bad about it.  It seems the same issues can be found in every corner
of IO. 

If I haven't seen further, it is by standing in the footprints of giants

More information about the Haskell-Cafe mailing list