Big tidy-up of deriving code
This tidy-up, triggered by Trac #1068, re-factors the way that 'deriving'
happens. It took me way longer than I had intended. The main changes,
by far are to TcDeriv; everyting else is a minor consequence.
While I was at it, I changed the syntax for standalone deriving, so that
it goes
derive instance Show (T a)
(instead of "derive Show for T"). However, there's still an implicit
context, generated by the deriving code, and I wonder if it shouldn't really
be
derive instance (..) => Show (T a)
but I have left it simple for now.
I also added a function Type.substTyVars, and used it here and there, which
led to some one-line changes otherwise unrelated (sorry).
Loose ends:
* 'deriving Typeable' for indexed data types is still not right
* standalone deriving should be documented
22 files changed: