I recently ran into a problem using good polymorphism with GADT. The answer was to give a “full user view” (CUSK) for my data type. I have read the relevant documentation , but still getting essentially the same error when I try to apply it to the class.
Specifically, as soon as I give CUSK, the following compiles:
{-
but when I transfer this definition to a class:
{-
I get an error message:
• Expected kind '(k1, k1) -> *', but 'f' has kind 'k -> *' • In the type signature: foo :: (f :: k1 -> *) (x :: k1) -> (f :: (k1, k1) -> *) ('(x, x) :: (k1, k1)) In the class declaration for 'Foo'
I expect something small that I need to do to convince the GHC that f is kind-polymorphic in the second example.
source share