-
Notifications
You must be signed in to change notification settings - Fork 39
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
Record fields with underscores give TH machinery trouble #29
Comments
The naming schema tried to create a field (GADT constructor) _pgHostField which is an invalid constructor name. I would suggest modifying the naming schema. There are many ways to make the name valid (strip _, add prefix) but putting these heuristics into the default schemas I think would make the library more "magical" |
Understood. However, we may want to expose some functionality that provides this prefix _ stripping, especially as lens becomes more and more prevalent and field names starting with _ are the norm there. |
Good point. My comment was about names normalization in general. If this is a common case, a NamingStyle adjustment function would be handy. Do you think that stripping underscores is the best option here? |
I guess so. It is not at all idiomatic to use underscores in general, so perhaps we can assume they are safe to strip. If someone has a special use case, they can always implement their own naming schema, right? |
That's right. I am not sure though if this case is popular enough to be included into the TH module. Otherwise you could use this schema modification just for your own project. |
Workaround:
|
The below yields a large error complaining about:
Example code:
The text was updated successfully, but these errors were encountered: