In GHC.Generics, the representation types are all of kind Type -> Type (i.e. the kind of the Rep a type family is Type -> Type). If you look at the instances that are used for Rep a p below you can see that this last type parameter p unused (I presume stands for p stands for phantom).
data V1 p -- lifted version of Empty
data U1 p = U1 -- lifted version of ()
data (:+:) f g p = L1 (f p) | R1 (g p) -- lifted version of Either
data (:*:) f g p = (f p) :*: (g p) -- lifted version of (,)
newtype K1 i c p = K1 { unK1 :: c } -- a container for a c
newtype M1 i t f p = M1 { unM1 :: f p } -- a wrapper
I was curious as to why this is? Could we not define these types without the parameter p? That is, make the kind of Rep a be Type and remove the parameter p from V1, U1, etc.
Also, is it fine to create the following instance?
instance MyTypeclass (U1 ()) where ...
The documentation recommends creating a helper typeclass MyTypeclass' f (the example in the documentation of GHC.Generic uses Encode/Encode').
instance MyTypeclass' U1 where ...
I see that in this way we don’t constraint to a specific phantom parameter, but then again I don’t know what this buys us…