patch applied (ghc): Deriving for indexed data types
Simon Peyton-Jones
simonpj at microsoft.com
Wed Dec 20 07:52:22 EST 2006
Manuel
| - We cannot derive Typeable. This seems a problem of notation, more
| than
| anything else. Why? For a binary vanilla data type "T a b", we
| would
| generate an instance Typeable2 T; ie, the instance is for the
| constructor
| alone. In the case of a family instance, such as (S [a] (Maybe
| b)), we
| simply have no means to denote the associated constuctor. It
| appears to
| require type level lambda - something like (/\a b. S [a] (Maybe b).
Suppose you have an indexed data type with kind
T :: * -> * -> * -> *
Of these parameters, suppose 2 are type indices and 1 is fully polymorphic.
Then shouldn't we generate an instance for Typeable1, *not* Typeable3:
instance (Typeable a, Typeable b) => Typeable1 (T a b) where...
Then there is no difficulty about generating its type representation is there?
Simon
More information about the Cvs-ghc
mailing list