Stop inferring over-polymorphic kinds

Authored by simonpj on Feb 21 2019, 9:27 AM.

Description

Stop inferring over-polymorphic kinds

Before this patch GHC was trying to be too clever
(Trac Trac #16344); it succeeded in kind-checking this
polymorphic-recursive declaration

data T ka (a::ka) b
  = MkT (T Type           Int   Bool)
        (T (Type -> Type) Maybe Bool)

As Note [No polymorphic recursion] discusses, the "solution" was
horribly fragile. So this patch deletes the key lines in
TcHsType, and a wodge of supporting stuff in the renamer.

There were two regressions, both the same: a closed type family
decl like this (T12785b) does not have a CUSK:

type family Payload (n :: Peano) (s :: HTree n x) where
  Payload Z (Point a) = a
  Payload (S n) (a `Branch` stru) = a

To kind-check the equations we need a dependent kind for
Payload, and we don't get that any more. Solution: make it
a CUSK by giving the result kind -- probably a good thing anyway.

The other case (T12442) was very similar: a close type family
declaration without a CUSK.

Details

Committed
Marge Bot <ben+marge-bot@smart-cactus.org>Mar 9 2019, 1:07 AM
Parents
rGHC2762f94dc27c: Fix #13839: GHCi warnings do not respect the default module header
Branches
Unknown
Tags
Unknown