-
Notifications
You must be signed in to change notification settings - Fork 16
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
Create records from tuples #20
Comments
The problem with this is that we would need to manually write one instance for each tuple size since there's no abstraction over all tuple sizes. Maybe we can get away with CPP macros? |
I would suggest generating the tuple instances. |
I suspect the compile time performance is due to |
This is done in jrec: https://github.com/juspay/jrec/blob/master/src/JRec/Tuple.hs The tuple is generated with a script in the TH is also an option. I think it brings record creation times from O(n^2) to O(n), but I have not benchmarked it. |
I see that newest version of vinyl supports creating records from tuples.
Maybe supporting this in superrecord would help with the problem of slow compile times?
(I tried superrecord out, found it quite good, but decided not to live with the longer compile times).
i.e. for a 7-tuple we would know in advance we are creating a record with 7 fields.
Going in the other direction would be nice as will. A function that maps from a tuple of field labels to a tuple of values. Would make reading multiple fields more concise.
The text was updated successfully, but these errors were encountered: