-
Notifications
You must be signed in to change notification settings - Fork 689
Factor code between records and typeclasses #15877
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
Conversation
a55314a
to
7cf276b
Compare
Sorry @proux01 , I'm having trouble following why this refactoring is an improvement. Could you summarize the idea a bit? |
@ejgallego the goal is to make more apparent what's common (and what differs) between record and class declarations. In particular the call to |
There was even a comment in the previous code: (* declaring structures, common data to refactor *) |
Thanks, I'll have a look again hopefully soon. |
Hi @proux01 sorry for the delay, can you rebase? |
The "needs: rebase" label was set more than 30 days ago. If the PR is not rebased in 30 days, it will be automatically closed. |
7cf276b
to
23167e3
Compare
@ejgallego done |
| Some _ -> implicits_of_context params @ impls in | ||
let data = List.map (fun ({ DataR.implfs; _ } as d) -> { d with DataR.implfs = List.map adjust_impls implfs }) data in | ||
(* let map (min_univ, arity, fieldimpls, fields) { Ast.name; is_coercion; cfs; idbuild; _ } = *) | ||
let map rdata { Ast.name; is_coercion; cfs; idbuild; default_inhabitant_id; _ } = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let maybe lambda-lift this to its own function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it's used in a List.map2
so I'd find it a bit strange to have a separate function requiring two list of the same length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seem like an improvement to me, but the code is still in quite terrible shape. I wonder if instead of making more code common, we could separate the paths more, but have a more granular component view and have the separate paths share code relative to these common components.
I have left a few comments if you wanna do another pass.
e0b8394
to
19227b4
Compare
This is a followup of rocq-prover#12611
Thanks @ejgallego for the careful review. Your comments should now be taken into account. |
Great! I will merge as soon as the CI pass. |
@coqbot: merge now |
@ejgallego: Please take care of the following overlays:
|
This is a followup of #12611 factoring some code between record and typeclass declarations.
Overlay (to be merged in sync with the PR):