Changes to Typeable
Simon Peyton-Jones
simonpj at microsoft.com
Mon Sep 24 18:28:30 CEST 2012
| - Will it be possible to write e.g. deriving instance Typeable Eq?
Not at the moment; we've only been thinking about Typable for things whose kinds bottom out in *, not Constraint. There doesn't seem to be any fundamental obstacle -- but I can't yet see how it would be useful.
| - How about deriving instance Typeable Typeable? (It seems Proxy Proxy
| works, so maybe this would too.)
Ditto.
| - Does it make sense to have an instance for (~)?
Ditto.
| - Will instances be provided for the types in base and built-in to GHC?
Yes, that would make sense.
| Automatically generate Typeable instances for every type constructor
| that is declared. 'deriving Typeable' becomes a no-op.
Well, at the moment a type ONLY becomes an instance of a class if you ask for it to be so, so your proposal would be a change of principle. Sometimes *omitting* an instance declaration may be important (eg to prevent a type being serialisable). That said, I can't see when I'd want a type not to be Typeable. I suppose it could be a compiler option. I think the questions here are ones of software engineering rather than being technical.
Simon
More information about the Libraries
mailing list