This simple code doesn't compile
import Data.Kind
type family F (k :: Type) :: (t :: k) -> Type
The error message is
• Expected a type, but ‘t’ has kind ‘k’
• In the kind ‘(t :: k) -> Type’
I get in some sense that this actually defines a "family of type families" but I don't really understand why this limitation would exist.
type family F (k :: Type) (t :: k) :: Type
does work but it doesn't have the same semantics and can't be used the same.
::
for a type family kinds? So the first one (would) say "kind t has sort k" while the second one says "type t has kind k"? – David Youngtype family F (k :: Type) :: k -> Type
is closer to what you want? – chi(k :: Type) -> (t :: k) -> Type
. In fact, it has no type which can be currently expressed in Haskell. The first type family is invalid because(->) :: Type -> Type -> Type
but you've explicitly declaredt :: k
andk
(a fresh type variable) doesn't unify withType
.(t :: Type) -> Type
would be completely valid (and is equivalent to the type in the accepted answer). – user2407038