Elaborate the typechecker's trace slightly
Add kind-defaulting in simplifyInfer (fixes Trac #7332)

The basic point here is described in TcSimplify
   Note [Promote _and_ default when inferring]
The new thing is that, when figuring out the predicates
to abstact over in simplifyInfer, we must default OpenKind
to *, just as we do in quantifyTyVar. I had not realised
how important this was until Oleg came up with Trac #7332.

As usual I did some refactoring, so the patch affects
many more lines than strictly necessary.
Comments only
Use isCheapApp in exprIsWorkFree

exprIsWorkFree was returning False for constructor applications
like (Just x).  Horror!  Now we delegate to isCheapApp, which does the
right thing.

I found this (by accident) when seeing why the simplifier was taking
more iterations than I expected.  So not only should we generate
better code as a result, but perhaps with fewer simplifier iterations.
General happiness.
Wrap a bracket quotation in a coercion that makes it have the right type

This is the right fix to Trac #7276 (part 2), which makes the
interaction with -fdefer-type-errors and TH work properly.
Refactor the type of tcBracked (no change in behaviour)
Move occurCheckExpand from TcCanonical to TcType
Improve error reporting for kind occurs-checks

Fixes Trac #7328.
Fix conversion of HsRule to TH syntax

We weren't doing the binders right, and were creating NameLs
rather than NameUs for the binders of the Rule.  That gave
very funny output for T7064.
Deprecate Rank2Types and PolymorphicComponents, in favour of RankNTypes

We agreed that it's not worth the bother of trying to maintain all
these distinct flags; RankNTypes will do the job fine.  Trac #6032.
Fix a long-standing bug in tidying

This showed up when looking at some type error messages.
We were tidying some open types in a way that mapped two
distinct variables to the same thing.  Urk!
Comments and debug tracing only
Improve error reporting for kind errors
In approximateWC, do not float contraints out of an implication with equalities

Jacques Garrigue pointed out that GHC 7.6 was accepting GADT programs
that our OutsideIn paper said would be rejected.  The reason was that
approximateWC was being too aggressive about floating; see Note
[approximateWC] in TcSimplify.

This simple patch fixes that, but it is (of course) not backward
compatible; a few GADT programs that were (erroneously) accepted
before are now rejected, and will need a type signature.  This could
be under flag control, but I'd rather just make it compulsory.

Example
   data T a where
     TInt :: T Int
     MkT :: T a

   f TInt = 3::Int

Here f (with no type signature) is current accepted, with inferred type
 f :: T a -> Int
but should be rejected
Some refactoring of the occurs check in TcUnify

I was experimenting with allowing unification with a type variable
when there are type functions in the type; but that led to strangely
worse error messages (See Note [Conservative unification check]) in
TcUnify.  I don't quite understand why, but the simple thing for now
is to maintain the same behaviour.  I tidied up the code a bit though.
Improve reporting of duplicate signatures

Fixes Trac #7338
Only promote *non-existential* data constructors

I don't konw how this was left out before; Trac #7347.

In fixing this I did the usual round of refactoring.  In particular, I
cached the fact that a DataCon can be promoted in the DataCon
itself (the dcPromoted field).
Suppress deprecation warnings for Rank2Types in libraries that use the flag

This is temporary until the libraries switch to RankNTypes
Wibbles in TcErrors
An accidentally-omitted part of commit 8019bc2c, about promoting data constructors