Fix DeriveGeneric for types with same OccName (#10487)

Authored by osa1 on Sep 24 2015, 2:51 AM.

Description

Fix DeriveGeneric for types with same OccName (Trac #10487)

Summary:
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).

Bonus content:

  • 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