On Fri, Nov 05, 2004 at 01:57:53PM +0100, Benjamin Franksen wrote:
> Hello Experts,
> 
> I need MVar and Chan to be instances of Typeable. Any hint on how this is most 
> easily done would be greatly appreciated. I could change the libraries and 
> add 'deriving Typeable' but I hesitate to do so.
> 
> Cheers,
> Ben

It can be done in Haskell 98 the same way `asTypeOf' is defined
in the Report:

instance Typeable a => Typeable (MVar a) where
    typeOf v    = mkAppTy (mkTyCon "Control.Concurrent.MVar.MVar")
                    [typeOf (t v)]
        where
            t   :: a b -> b
            t   = undefined

Groetjes,
Remi

-- 
Nobody can be exactly like me. Even I have trouble doing it.
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to