RE: patch applied (ghc): Deriving for indexed data types

Simon Peyton-Jones <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.all
Message-ID <DCA83D5F3861C941808187D4D387875036FB4665__41085.9835254543$1166619166$gmane$org@EA-EXMSG-C312.europe.corp.microsoft.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.