{-# language TypeFamilies, AllowAmbiguousTypes, DataKinds, UndecidableSuperClasses, UndecidableInstances, TypeFamilyDependencies, QuantifiedConstraints #-} module M where import Data.Kind (Type) import Data.Proxy (Proxy (Proxy)) class C a where instance C Int type family F x :: Type -> Type class C (F x a) => CF x a instance C (F x a) => CF x a -- workaround fun'' :: forall x. (forall a. C a => CF x a) => Proxy x -> () fun'' = fun0 @x @Int -- rejected: "Illegal type synonym family application ‘F x’ in instance" -- fun0 :: (C Int => C (F x Int)) => Proxy x -> () -- fun0 = undefined -- compiles fine fun0 :: C (F x a) => Proxy x -> () fun0 = undefined -- another copy of the workaround fun2'' :: (forall a. C a => CF x a) => Proxy x -> () fun2'' = fun20 -- compiles fine fun20 :: C (F x Int) => Proxy x -> () fun20 = undefined