
8 Jul
2011
8 Jul
'11
4:17 a.m.
We currently have Foreign.Marshal.Unsafe.unsafeLocalState :: IO a -> a unsafeLocalState = unsafePerformIO however, unsafePerformIO in GHC is rather expensive, because it tries to avoid the IO being executed more than once when there are multiple processors. However, for the cases that we claim unsafeLocalState is to be used for, it would be safe to use the cheaper unsafeDupablePerformIO instead. The only way to get at unsafeDupablePerformIO currently is from GHC.IO, this would give users a legitimate way to get at a cheaper unsafePerformIO. Or perhaps we should just export unsafeDupablePerformIO from System.IO.Unsafe? Thoughts? Cheers, Simon