instance Typeable (Re: How do I create dynamic exceptions)

Christian Maeder maeder@tzi.de
Tue, 22 Jul 2003 15:01:39 +0200


>>data MyException = MkExc Int String
> 
> 
> ... but now it seems I have to install this as an instance of Typeable, and
> I don't see how to do that.
> 
> 
>>instance Typeable MyException where
>>  typeOf ? = ?

import Data.Dynamic


myExceptionTc = mkTyCon "MyException"

instance Typeable MyExceptionBasicSpec where
     typeOf _ = mkAppTy myExceptionTc []


The above should work, but I wonder when it is possible to simply derive 
Typeable?

Cheers Christian