-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type level constructor/record information #8
Comments
Just a note: I have been looking into this, and I agree in general that it'd be nice to have more metadata available on the type level. I'm not yet sure about the concrete design though. I'll make things available for discussion in a separate branch soon. |
This is still ongoing, but it's part of a longer, more complicated story, I'm afraid. |
There is now a branch https://github.com/well-typed/generics-sop/tree/type-level-meta-simpler that has full type-level meta information available (but only works with GHC 8 right now). It therefore also has the record information available on the type level. However, I don't like the interface. The structure in which the info is provided mirrors the structure we had at the value level. However, it is not identical, and it is not particularly pleasant to work with. I think what I might generally prefer is to merge the type-level metadata with the code. The argument about not separating them does not seem to apply on the type level, because we can easily forget everything we do not want, and also still provide the plain code. One experiment using this right now is https://github.com/kosmikus/records-sop, and we can already see that for records, I'm converting to a much more convenient representation that lines up the field labels with the types. Unfortunately, I'm somewhat afraid that every application will require a slightly different type-level representation, so one can argue that as long as it's simple enough to compute them, we should not try very hard to predict all the use cases. I still think we can probably find a better default. At least there's a starting point for experimentation now, finally. |
With PR #31 now merged, I'm going to close this. While there's no Feel free to open another issue if there are suggestions for how to improve the interface. Sorry that this took ages to actually get done. |
The
Code
type family gives the list of argument types to each constructor of a type, but there's no obvious way to get (at the type-level) whether those constructors are records or not. It be wonderful if there were such a type family (IsRecord a :: '[Bool]
), that maintained the same order asCode
.The text was updated successfully, but these errors were encountered: