
#13613: Simplify fixIO -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: task | Status: new Priority: normal | Milestone: 8.4.1 Component: Core | Version: 8.0.1 Libraries | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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`. {{{#!hs 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13613 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler