(I agree with the two Simons; just want to throw in a few more
considerations.)

Just curious ... What's the use case, Frank? (It is probably related to
debugging or assertion checking; do you have code details that you want
to share?) Do you *really* want to do type-case on those multi-arity
parametric types in the sense that you would care about keeping n, n-1,
n-2, ..., 1 type positions polymorphic when casting? If you don't, then
monomorphic instances of Typeable would be fine. And they are much
easier to generate, indeed. (Typeable.h in the Data/include dir (ghc
cvs) could be of help to solve the problem before GHC catches up.)

It's perhaps useful to recall that the arity-sensitive Typeable business
was introduced for the purpose of polymorphic type-case in the context
of generic programming with SYB1 and 2 (a bit less at level 3) BTW, for
the ICFP 2005 style of SYB (level 3), Typeable instances may be entirely
avoidable, depending on programming style and scenario.

All the best,
Ralf

(Once again, sounds like kind-polymorphism would simplify the
implementation and the use of Haskell.)

> -----Original Message-----
> From: Simon Peyton-Jones
> Sent: Wednesday, August 10, 2005 3:32 AM
> To: Simon Marlow; 'Frank Huch'; 'glasgow-haskell-bugs@haskell.org'
> Cc: Ralf Lammel
> Subject: RE: Deriving Typeable instances
> 
> Yes, you could I suppose.  But then there'd be a different peculiar
change
> in behaviour at arity 7.  I'm not sure that'd be an advantage.
> 
> Simon
> 
> | -----Original Message-----
> | From: Simon Marlow
> | Sent: 10 August 2005 10:58
> | To: Simon Peyton-Jones; Frank Huch; glasgow-haskell-bugs@haskell.org
> | Subject: RE: Deriving Typeable instances
> |
> | On 09 August 2005 17:16, Simon Peyton-Jones wrote:
> |
> | > I'm not against this, although you can work around the problem by
> | > adding a library that defines the missing type classes (Typeable8,
> | > Typeable9 etc), and making your compiler generate the instance
> | > itself.  There is nothing magic about 'deriving'; it's just
> | > convenient.
> |
> | If the arity is >7, couldn't we just generate a Typeable instance,
> rather than the TypeableN instance?
> | It would mean you wouldn't get the benefits of TypeableN, but at
least
> you'd have Typeable.
> |
> | Cheers,
> |     Simon
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to