Expose kind information for type variables with reify
The comment on TyVarI notes that the attached Type is always
VarT theName, and that this could potentially be extended. Currently, there isn't a way to access kind information for a type variable through the Template Haskell API. It would be useful (at least for me) to have this ability here.
The limitation on the returned Type comes from the ATyVar clause of reifyThing, which zonks the TyVar to a GHC type and then uses reifyType to convert it to a TH type. For a TyVarTy, reifyType always returns
I can see a few possible ways of exposing kind information here:
(a) Fill the Type argument to TyVarI with
SigT (VarT theName) theKind. This could be done either as a special case in place of the call to reifyType in reifyThing, or as a modification to reifyType's behavior. The question of when SigT should be included is open: all the time? when the kind isn't
*? when the kind is something that involves more than
(b) Change TyVarI from
TyVarI Name Type to
TyVarI Name TyVarBndr. This seems like the most straightforward, stable way of exposing kind information, but it requires a breaking API change.