[GHC] #8006: Asynchronous exception rethrown synchronously inside runStmt
GHC
ghc-devs at haskell.org
Fri Jun 28 16:45:38 CEST 2013
#8006: Asynchronous exception rethrown synchronously inside runStmt
---------------------------------+------------------------------------------
Reporter: edsko | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: None/Unknown
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by simonmar):
If repeating the I/O is what you want, then you can do that - indeed,
that's what I suggested that we should do, and this ticket is Edsko's
followup after investigating that possibility. For some background, we
adopted this approach in the I/O library for lazy I/O, see #3997, and
`Note [async]` in `libraries/base/GHC/IO/Handle/Internals.hs`.
Edsko's objection to doing this in GHC is that there are a lot of places
where we catch exceptions inside `unsafePerformIO` or equivalent, and it
probably isn't safe to repeat the I/O in all of them. Well, maybe it is -
I'm not sure.
The semantics of async exceptions doesn't say anything about this, because
it doesn't include `unsafePerformIO` - IO is strictly at a higher level
than pure computation.
What seems attractive about having a different kind of catch is that it
avoids the problem in cases where we're only interested in catching a
subset of exceptions, which is what we're doing in GHC: both `tryM` and
`tryMostM` want to just pass through async exceptions. You're right that
it doesn't help if you want to do some cleanup (`bracket` or `finally`).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/8006#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list