Proposal: add Control.Exception.SomeAsyncException

Roman Cheplyaka roma at ro-che.info
Wed Feb 5 10:08:23 UTC 2014


I just discovered that SomeAsyncException under the exact same name and
with the same intention has been added to base-4.7 (GHC 7.8). How cool
is that?

I'll release http://hackage.haskell.org/package/asynchronous-exceptions
which can act as a compatibility package for older bases.

Roman

* Roman Cheplyaka <roma at ro-che.info> [2014-02-05 10:56:45+0200]
> 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/6da111c8/attachment.sig>


More information about the Libraries mailing list