Check kinds for ambiguity
GHC does an ambiguity check on types. It should also do the same for kinds. Here is a program that should be rejected:
type family F a
data T :: F a -> Type
T
's kind is ambiguous, and any occurrence of T
will be rejected. Instead of rejecting usage sites, let's just reject the definition site.
This check would be disabled by AllowAmbiguousTypes
.
Happily, I think the implementation should be easy, and that the current algorithm to check for ambiguous types should work for kinds, too. After all, types and kinds are the same these days.
This was inspired by #14203 (closed), but no need to read that ticket to understand this one.
EDIT: See ticket:14419#comment:160844 and ticket:14419#comment:163265 for the nub of what needs to be done here.