-
Notifications
You must be signed in to change notification settings - Fork 637
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
Allow projections to be declared as classes. #9711
Conversation
@mattam82 is this PR dead? |
It's been forgotten, I'll try to bring it back to life |
@mattam82 ping. I believe this is quite high priority actually. |
@ppedrot I’m on holidays next week, so if you want to pick it up you’re welcome. Otherwise thanks for the reminder ! |
45e6392
to
7c6714f
Compare
Rebased now, let's see. |
@ppedrot this is ready now. |
7c6714f
to
5a0a45b
Compare
@@ -130,22 +138,19 @@ let rec is_class_type evd c = | |||
match EConstr.kind evd c with | |||
| Prod (_, _, t) -> is_class_type evd t | |||
| Cast (t, _, _) -> is_class_type evd t | |||
| Proj (p, c) -> GlobRef.(Map.mem (ConstRef (Projection.constant p))) !classes |
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 adding a new dependency to the legacy constant binding mechanism. I know we're a bit in a hurry w.r.t. the release, but instead of doing that we should have a type of global references including projections. I can validate the PR as is, but if you have time, could you do that the right way from the start?
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.
Hmm, I don't really have time right now, but indeed that should happen next. Note that we already had code using Projection.constant
here, so it's not really worse than before.
doc/changelog/02-specification-language/9711-primitive-projection-classes.rst
Outdated
Show resolved
Hide resolved
5a0a45b
to
726a496
Compare
@mattam82 can you squash the last commit? It's useless to keep it. |
726a496
to
2a691de
Compare
Sure. I rebased on #14392 to see where CI gets now. |
Erm, I would gladly have merged this PR without the additional comments as soon as the original CI would have finished... This needs to be merged before the branch, so you'll have to rebase again to remove the commits once your experiment is finished. |
That's fine. I'm not sure this is the end just yet. |
Hey, I have detected that there were CI failures at commit 2a691de without any failure in the test-suite. |
1 similar comment
Hey, I have detected that there were CI failures at commit 2a691de without any failure in the test-suite. |
Why is coqbot repeating the very same thing twice? |
It'll report again every time the overall pipeline status check is finished. If a job fails and then someone restarts the job, when it finishes the second time, this will trigger a second comment. Perhaps that's what happened? (The coq-tools issue is on my side, I'll fix it shortly, sorry.) |
What is coq-tools ? |
Yes, I did retrigger it. |
Do you mean that the failure of the ci-coq_tools job is your fault? |
Yes, I pushed what I thought was an innocuous commit working around an intermittent issue with the native compiler, not realizing that it would change the output log, and I didn't enforce the discipline of running the test-suite before pushing. This broke about half of the output tests, which I'm now fixing; it should be fixed within 10 minutes, and sorry about this. |
That's good news, both PRs should go green by tonight then! |
coq-tools should be fixed now, I've restarted it |
Hey, I have detected that there were CI failures at commit 2a691de without any failure in the test-suite. |
... still failing it seems. |
Yeah, I forgot that |
2a691de
to
ba0125a
Compare
ba0125a
to
ad3d2b4
Compare
@mattam82 in order not to lose time I have rebased and slightly tweaked the commit message, I'll merge when the CI finishes. |
@ppedrot thanks a whole bunch! |
Kind: feature
This fixes an arbitrary limitation of typeclasses, which didn't allow primitive projections
to be declared as class heads. They can usefully be used as proxys. In our use case:
We want to declare
ur
as a type class head, as in all instances ofUR
,ur
is itself defined by a type-class. We can use a hint to unfold theur
projection when applied to a particularUR
instance to simplify the goal to a new typeclass constraint. This allows a kind ofdependent
type-class resolution.As long as users did not try to do
Existing Class ur
for some primitive projectionur
, which had no effect previously, this should be backwards compatible.Fix #12975, fix #8994.