
#13330: forkIO has inconsistent behavior under optimization -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Core Libraries | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3189 Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * owner: dfeuer => (none) * status: closed => new * resolution: fixed => Comment: This is a tricky area so I'd like to be quite sure I understand. Several things: * The `$exceptions_and_strictness` note in `GHC/IO.hs` says
While @test1@ will print "it failed", @test2@ will print "uh oh".
Previously it said that `test2` was unpredictable. Are we saying that both are now predictable? That's good but why? * The note does not say that the only difference between `catchException` and `catch` is that the former is strict in the action. Indeed, it'd be better to make that point in the doc for `catchException` itself; it's the ''only'' difference between the two.
Since this strictness is a small optimization and may lead to surprising results, all of the @catch@ and @handle@ variants offered by "Control.Exception" use 'catch' rather than 'catchException'.
* But the comment is confusing. If `catchException` is more efficient (and we might want to say why) should we not use it all the time in the libraries if we can? What are the "surprising results" that you have in mind? * Moreover, specifically what "handle variants" do you have in mind? `handle` and `handleJust`? But also `catchJust`. ------------- Finally, does this efficiency matter? What is the nofib perf loss if we use `catchException = catch`? And if there is some, can we see a poster- child example so we can really understand when it's important? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13330#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler