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.
Remove unused -ddump flags
Put header and timestamp in dump files
Refactor the way dump flags are handled

We were being inconsistent about how we tested whether dump flags
were enabled; in particular, sometimes we also checked the verbosity,
and sometimes we didn't.

This lead to oddities such as "ghc -v4" printing an "Asm code" section
which didn't contain any code, and "-v4" enabled some parts of
"-ddump-deriv" but not others.

Now all the tests use dopt, which also takes the verbosity into account
as appropriate.
Turn DYNAMIC_BY_DEFAULT off in mk/build.mk.sample

It sets GhcLibWays=v, which doesn't work with DYNAMIC_BY_DEFAULT on
as the dynamic libs aren't built.
Follow 'flags' -> 'generalFlags' rename
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
Whitespace only in nativeGen/PIC.hs
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