Proposal: add Control.Exception.SomeAsyncException
Roman Cheplyaka
roma at ro-che.info
Wed Feb 5 08:56:45 UTC 2014
It is often useful to distinguish between synchronous and asynchronous
exceptions. The common idiom is to run a user-supplied computation
catching any synchronous exceptions but allowing asynchronous exceptions
(such as user interrupt) pass through.
There's no way to know how — synchronously or asynchronously — an
exception was thrown, so we have to work around it by relying on the
exception type itself.
Unfortunately, the AsyncException type was designed as a leaf in the
exceptions hierarchy, so it's not possible to extend it with
user-defined asynchronous exception types.
Thus I propose to add SomeAsyncException as an extensible type ("class")
of asynchronous exceptions. It will be a direct subclass of
SomeException, and will become the superclass of the existing
AsyncException type.
Users can then define their own asynchronous exceptions by subclassing
SomeAsyncException.
My main motivation for this change is exceptions used for timeouts. So
the second part of this proposal it to mark System.Timeout.Timeout as an
asynchronous exception.
Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140205/8e462913/attachment.sig>
More information about the Libraries
mailing list