Respect Note [The tcType invariant]

Authored by simonpj on Mar 2 2018, 11:26 AM.

Description

Respect Note [The tcType invariant]

I tried to do this with

commit 0a12d92a8f65d374f9317af2759af2b46267ad5c
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Wed Dec 13 12:53:26 2017 +0000

Further improvements to well-kinded types

The typechecker has the invariant that every type should be well-kinded
as it stands, without zonking.  See Note [The well-kinded type invariant]
in TcType.

That invariant was not being upheld, which led to Trac #14174.  I fixed
part of it, but T14174a showed that there was more.  This patch finishes
the job.

But I didn't get it quite right as Trac Trac #14873 showed.

This patch fixes the problem; although I am still a bit unhappy.
(See "A worry" in the HsApp case of tc_infer_hs_type.)