Fix DeriveGeneric for types with same OccName (Trac #10487)
DeriveGeneric generates some data types (for data type constructors and for
selectors of those constructors) and instances for those types. This patch
changes name generation for these new types to make it working with data types
with same names imported from different modules and with data types with same
names imported from same modules(using module imports).
- Some refactoring in TcGenGenerics.metaTyConsToDerivStuff to remove some redundant partial function applications and to remove a duplicated function.
- Remove some unused names from OccName. (those were used for an old implementation of DeriveGeneric)
Reviewers: kosmikus, simonpj, dreixel, ezyang, bgamari, austin
Reviewed By: bgamari, austin
Subscribers: ezyang, thomie
Differential Revision: https://phabricator.haskell.org/D1081
GHC Trac Issues: Trac #10487