Several fixes to 'deriving' including Trac #2378
This patch collects several related things together.
* Refactor TcDeriv so that the InstInfo and the method bindings are renamed
together. This was messy before, and is cleaner now. Fixes a bug caused
by interaction between the "auxiliary bindings" (which were given
Original names before), and stand-alone deriving (which meant that those
Original names came from a different module). Now the names are purely
local an ordinary.
To do this, InstInfo is parameterised like much else HsSyn stuff.
* Improve the location info in a dfun, which in turn improves location
info for error messages, e.g. overlapping instances
* Make sure that newtype-deriving isn't used for Typeable1 and friends.
(Typeable was rightly taken care of, but not Typeable1,2, etc.)
* Check for data types in deriving Data, so that you can't do, say,
deriving instance Data (IO a)
* Decorate the derived binding with location info from the *instance*
rather than from the *tycon*. Again, this really only matters with
standalone deriving, but it makes a huge difference there.
I think that's it. Quite a few error messages change slightly.
If we release 6.8.4, this should go in if possible.