Thans to @danidiaz, I’ve discover the Higgledy package.
It claims that it can make a HKD from a plain record.
When we work with higher-kinded data, we find ourselves writing types like:
data User f
= User
{ name :: f String
, age :: f Int
, ...
}
This is good - we can use f ~ Maybe for partial data, f ~ Identity for complete data, etc - but it introduces a fair amount of noise, and we have a lot of boilerplate deriving to do. Wouldn't it be nice if we could get back to writing simple types as we know and love them, and get all this stuff for free?
data User
= User
{ name :: String
, age :: Int
, ...
}
deriving Generic
-- HKD for free!
type UserF f = HKD User f
Is it too good to be true ? I even don’t understand how it could work. Could someone explain please ?