Proposal: Extensible exceptions

Ian Lynagh igloo at earth.li
Mon Jul 7 11:48:53 EDT 2008


On Sun, Jul 06, 2008 at 05:32:02PM -0400, Isaac Dupree wrote:
> I have some trouble 
> seeing from the patches what the hierarchy of exceptions will be;

Right, it's a bit obfuscated at the moment, as some of the types are
where we want them to be (portable modules like Control.Exception) while
others are where they need to be (GHC.*, to avoid import loops).
Hopefully we can improve that later.

Anyway, these patches basically only add the machinery for extensible
exceptions, but don't define much in the way of a hierarchy themselves.
All I've done is to break up the old Extension type:
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html#t%3AException

e.g. for constructors like
    ArithException ArithException
the ArithException type is an instance of Exception,

for constructors like
    BlockedOnDeadMVar
I've made a new type
    data BlockedOnDeadMVar = BlockedOnDeadMVar
that is an instance of Exception,

and for constructors like
    RecConError String
I've made a new type
    data RecConError = RecConError String
that is an instance of Exception,

> could you describe what the current proposal is for that 
> hierarchy? (if it exists yet)

So it doesn't really exist yet. That can be done later, either all at
once or bit by bit.


Thanks
Ian



More information about the Libraries mailing list