On Fri, 5 Nov 2004 14:43:55 +0100 Benjamin Franksen <[EMAIL PROTECTED]> wrote: <snip> > the instances by hand. My first attempt was: > > instance Typeable a => Typeable (MVar a) where > typeOf x = > mkAppTy (mkTyCon "Control.Concurrent.MVar.MVar") [typeOf (undefined::a)] > > but unfortunately this doesn't work. Ghc complains about > > Ambiguous type variable `a1' in the top-level constraint: > `Typeable a1' arising from use of `typeOf' at Helpers.hs:8 > > The reason is apparently that inside the definition of typeOf the type > variable 'a' is not unified with the 'a' from the instance header. I could > write
You can write: instance Typeable a => Typeable (MVar a) where typeOf (x :: MVar a) = mkAppTy (mkTyCon "Control.Concurrent.MVar.MVar") [typeOf (undefined::a)] Hope it helps, Koji Nakahara _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe