Proposal: Extensible exceptions

Isaac Dupree isaacdupree at
Thu Jul 17 09:16:36 EDT 2008

I'm a little concerned about it being a hierarchy that doesn't support 
multiple inheritance.  For example, if we want "exceptions with code 
location info" to be catchable in such a way that we can manipulate that 
info (even though those exceptions would span across a sensible 
hierarchy, yet not all exceptions would provide it).  It would be 
possible to model exceptions as a set of classes, e.g.

data Exception = Exception [InTypeable]
data InTypeable = forall a. (Typeable a{-,perhaps?? Show a-}) => 
InTypeable a

--then sort of similar datas as we're used to from the proposal
data IOException = forall a. (IOException a) => IOException a

and you can catch exceptions that match some set of classes somehow. 
Hopefully all exceptions would provide 'show' somehow.  Modelling it as 
a list [InTypeable] seems not ideal, but typeable doesn't provide 
anything like an Ordering for Set or anything more abstract?

I'm not entirely happy with this particular sketch of a proposal, but do 
people think that my initial issue is something to be concerned about at 
all?  (I'd be glad to be disproved :-)


More information about the Libraries mailing list