I working on type families in Haskell to get deeper inside this topic, and trying to use polymorphic kinds and type families at the same time.
For example, the beginning of the file has the following language extensions (there is more in the file later than will be shown here):
{-# LANGUAGE TypeFamilies,
StandaloneKindSignatures,
RankNTypes,
PolyKinds,
DataKinds,
TypeOperators,
TypeApplications,
KindSignatures,
ScopedTypeVariables,
UndecidableInstances,
MultiParamTypeClasses,
AllowAmbiguousTypes #-}
Then I'm using polymorphic kinds in type declaration:
data Proxy (a :: k) = Proxy
which works well. But at the time I'm trying to use them inside type families with richer definition:
type family PK (a :: k) :: Type where
PK Int = Char
GHC throws an error:
• Expected kind ‘k’, but ‘Int’ has kind ‘*’
• In the first argument of ‘PK’, namely ‘Int’
In the type family declaration for ‘PK’.
Is there a fix for that? The GHC version is 8.10.7. Thanks for any idea and help in advance.