[Haskell-cafe] Making MVar and Chan Instances of Typeable
Remi Turk
rturk at science.uva.nl
Fri Nov 5 20:21:19 EST 2004
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.
More information about the Haskell-Cafe
mailing list