WIP: Type/data instances: require that the instantiation is determined by the LHS alone (#23515)
This is the new version of @sand-witch's !10672 (closed), addressing #23515.
The compiler change is in GHC.Tc.TyCl.
I've added fixes for the 61 test failures that occurred in the previous MR and rebased onto master.
I will open a head.hackage MR with the necessary patches once CI tells me which packages are failing. At this point I can at least say that it affects contravariant (which has a lot of reverse dependencies) and servant.
Quick note on what kind of failures were commonly seen in the test, in no particular order:
- Need to explicitly write non-linear patterns on kinds
type (==) :: k -> k -> Bool type family a == b where - f a == g b = f == g && a == b + f (a::k) == g (b::k) = f == g && a == b a == a = 'True _ == _ = 'False
- User implicitly expects a kind to be
Type
type family N' a where - N' (t a) = [a] + N' (t (a :: Type)) = [a] N' a = ()
- Need to pattern match on return kind
type family Foo a :: k - type instance Foo Int = Bool + type instance Foo @Type Int = Bool
- Matching on
(->)
is, by default, levity polymorphictype family F a where - F (a -> _) = Maybe a + F ((a :: Type) -> _) = Maybe a
Edited by Jakob Brünker