I have a data type that looks like
data G f n a where
G :: a -> G f n a -> G f (f n) a
It's a container indexed by naturals, which takes a function that determines how to proceed inductively.
I can define a type synonym easily like
type G' n a = G S n a
But I'd like to be able to use the identity function.
I tried using Data.Functor.Identity, but even when redefined with PolyKinds, I can't get a type-level function on Naturals (:k Identity => Nat -> Nat
), so I turned to type families, defining
type family Id a where
Id a = a
which, cool, it compiles. Unfortunately, I supply type G'' n a = G Id n a
and I get the error message of
The type family ‘Id’ should have 1 argument, but has been given none
In the type synonym declaration for ‘G''’
So is there a way I can use a type family in a type synonym? That seems like the ideal end state.
(The extensions I'm currently using are
{-# LANGUAGE GADTs, TypeFamilies, DataKinds, TypeInType, PolyKinds #-}
)