Simplify fixIO
Now that we have noDuplicate#
, I think we can make fixIO
much simpler, and perhaps also faster, using something like what we do for ST
.
data Res a = Res (# State# RealWorld, a #)
fixIO f = IO $ \s ->
let Res r@(# _s', a #) = unIO (noDuplicate >> f a) s
in r
If f
forks an IO
thread demanding a
, the noDuplicate
should ensure that the computation is not re-entered, and the thread should wait for the main computation to complete.
So I believe, anyway. The comment about eager blackholing here is a bit vague and doesn't give an example.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Task |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Core Libraries |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |