Proposal: add new forms of unsafePerformIO and
stefanor at cox.net
Thu Feb 14 17:18:09 EST 2008
On Thu, Feb 14, 2008 at 10:54:37AM +0000, Duncan Coutts wrote:
> This version of 'unsafePerformIO' is slightly more efficient, because it
> omits the check that the IO is only being performed by a single thread.
> Hence, when you write 'unsafeDupablePerformIO', there is a possibility
> that the IO action may be performed multiple times (on a
> multiprocessor), and you should therefore ensure that it gives the same
> results each time.
> unsafeDupablePerformIO :: IO a -> a
> TODO: Actually, unsafeDupableInterleaveIO is not yet documented,
> that will have to be fixed.
> unsafeDupableInterleaveIO :: IO a -> IO a
I propose that unsafeDupablePerformIO be renamed to unsafePerformIO,
since it satisfies all of the properties guaranteed of unsafePerformIO.
GHC's unsafePerformIO guarantees more, and should be called
unsafePerformIOAtMostOnce or something.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/libraries/attachments/20080214/753920d6/attachment.bin
More information about the Libraries