Is it possible to construct a kind level identity which maps a kind a to the same kind a in haskell ?
Here are some non-answers :
type One :: * -> *
newtype One a = One {unOne :: a}
-- >>> :kind! 'One
-- 'One :: a -> One a -- not the identity
-- = 'One
type family Id a where -- *pointwise* identity, not a function (can't not apply it)
Id a = a
Currently the type language is first-order, meaning unmatchable functions like
Idmust be fully saturated: Higher-Order Type-Level Programming in Haskell.A proposal has been accepted to remedy this: Unsaturated type families.
Under this proposal we distinguish between the kind of
One :: Type -> TypeandId :: k -> k;Oneis matchable andIdis unmatchable:and we will be able to pass unmatchable type-level functions as arguments:
This will allow you to construct proper identity functors, functor composition and categorical gadgets.