-
Notifications
You must be signed in to change notification settings - Fork 671
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
Typeclasses default mode #19473
Typeclasses default mode #19473
Conversation
33a834c
to
9718d58
Compare
@coqbot run full ci |
One thing that is missing in the What does the change of default hint mode mean here in practice for typeclasses? |
I backtracked on changing the default, too much incompatibilities arise. If one changes it from "-" to "!" or "+" it will generally incur more failed typeclass searches (or speedups in successful searches). I can add more doc, that's really necessary. |
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.
wording suggestions
Instead of changing the global default for everyone, my suggestion would be to do it for new user-created stuff, like proposed in #19117. |
Indeed, the change of default hint locality is a somewhat successful prior of this technique. We could first warn when modes are missing, turn this at some point in an error for one version and then switch the default. |
Agreed @TheoWinterhalter, that was the original motivation of this PR to be able to set the default mode to "!" in GoodDefaults :) |
@coqbot run full ci |
🔴 CI failures at commit 9718d58 without any failure in the test-suite ✔️ Corresponding jobs for the base commit 9ed5a0f succeeded ❔ Ask me to try to extract minimal test cases that can be added to the test-suite 🏃
|
58e5fe3
to
2bb3c20
Compare
I backtracked on trying to change the default or any mode declaration in the stdlib to ensure compatibility for now. |
@coqbot run full ci |
@coqbot run full ci |
It just needs a changelog and review now. |
@gares could you assign and merge? |
let evi = Evd.find_undefined evd ev in | ||
let ev_class = class_of_constr env evd (Evd.evar_concl evi) in | ||
if Option.is_empty ev_class then accu | ||
else (* focus on one instance if only one was searched for *) | ||
if Option.has_some accu then raise MultipleFound | ||
else (Some ev) | ||
match Evd.find_undefined evd ev with | ||
| exception Not_found -> None | ||
| evi -> | ||
let ev_class = class_of_constr env evd (Evd.evar_concl evi) in | ||
if Option.is_empty ev_class then accu | ||
else (* focus on one instance if only one was searched for *) | ||
if Option.has_some accu then raise MultipleFound | ||
else (Some ev) |
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.
why this change?
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.
This is a bugfix
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.
It would otherwise result in an uncaught exception
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.
Why though? What's the test case?
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.
I guess the evar in question could be solved by a previous TC resolution. Does this make sense?
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.
Yes, it could be solved from another resolution in principle.
@coqbot run full ci |
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.
Further suggestions
vernac/record.ml
Outdated
let { Goptions.get = typeclasses_default_mode } = | ||
let interp = function | ||
| Hints.ModeInput -> "+" | ||
| Hints.ModeOutput -> "-" | ||
| Hints.ModeNoHeadEvar -> "!" | ||
in |
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.
I would prefer to have this code next to the one for parsing modes.
@mattam82 I think we can merge, but I also think you could rebase and squash. Just tell me if you do any other change, cause CI was already green and I'd rather not run it again if not needed. |
Overlay for elpi Add tests for the mode attribute of Class Add changelog Move parse_mode(s) to hints.ml Slightly simplify code Fixed parsing rule for mode attribute, refering to Hint Mode syntax definition (as is done for the warning attribute for example) Expose string of mode and factorize code
966f593
to
a6362e5
Compare
I just did your nitpick and squashed, factorizing with code in hints.ml (string_of_mode). A light pipeline should be enough here. |
@coqbot merge now |
@gares: You cannot merge this PR because:
|
sudo @coqbot merge now |
@gares: Please take care of the following overlays:
|
Overlay for PR 19473 LPCIC/coq-elpi#683