Thanks for the e-mail.  Things make a lot more sense now!!

I had another question: is there a (relatively) easy way to programmatically
derive Typeable for types with more than 7 parameters?

Thanks,
Jean

On Mon, May 4, 2009 at 5:05 AM, Simon Peyton-Jones <[email protected]>wrote:

>   I might just be very confused about how instance definitions are stored,
> but what is the difference between the type variables stored with a specific
> instance (that one can get with is_tvs) and the type variables stored with
> the class?
>
> They are utterly un-connected!  Eg
>
>               class C a where ...
>
>               instance (Eq p, Ord q) => C (p,q) where ...
>
> There is no need for the type variables of the class (‘a’ in this case) to
> match, either in name or number, the type variables of the instance (‘p’,
> ‘q’ in this case).
>
> If you want the signatures of the instances, just get the DFunID of the
> instance (use InstEnv.instanceDFunId). The type of that Id gives you the
> signature of the instance.  Eg. for the above instance, the dfunid has type
>
>               forall p,q. (Eq p, Ord q) => C (p,q)
>
> Also, the error messages seem to be coming from trying to do this for type
> class instances that involve type variables in some context.  (For example,
> (Show a, Show b, Show c) => Show ((,,) a b c).)  Any suggestions about what
> to watch out for when dealing with these?
>
> I’m sorry I just can’t figure out what you are asking here.
>
> Simon
>



-- 
Jean Yang
http://web.mit.edu/jeanyang/www/
Save us!  Think before you print.
*^^`
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to