Prevent duplication of unsafePerformIO on a multiprocessor
Fixes #986. The idea is to add a new operation
noDuplicate :: IO ()
it is guaranteed that if two threads have executed noDuplicate, then
they are not duplicating any computation.
We now provide two new unsafe operations:
unsafeDupablePerformIO :: IO a -> a
unsafeDupableInterleaveIO :: IO a -> IO a
which are equivalent to the old unsafePerformIO and unsafeInterleaveIO
respectively. The new versions of these functions are defined as:
unsafePerformIO m = unsafeDupablePerformIO (noDuplicate >> m)
unsafeInterleaveIO m = unsafeDupableInterleaveIO (noDuplicate >> m)