-
Notifications
You must be signed in to change notification settings - Fork 264
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
Fix quantification order for a op
b and a %m -> b
#640
Fix quantification order for a op
b and a %m -> b
#640
Conversation
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.
Thank you for taking this on. Let's move quickly and submit in a couple of days.
1. Keep the current (incorrect) quantification order. This means adding a | ||
special case to the specification instead of changing the implementation. |
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.
Alternative 1.5: do only the fix for %m
, because it only affects experimental code, and the other has been here for a long time and we would bite that particular bullet.
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.
Added it as a third alternative.
I am wondering how we would even warn about this sensibly and how people could act on that. I don’t see a way to use type applications that works before and after this change. So by warning first we would kinda force people into not using type applications on type operators for a while or removing the warning. I agree that this is all probably a moot point since this likely happens nowhere. Question for the implementation: Can we maybe inform people about this change when they run into a type error in the context of a type application to a type operator? |
This would mean tracking, for each implicitly quantified type variable, whether it's used as a type operator or not. Type applications can be used with definitions coming from other modules, so we'd also have to store this information in interface files. It's not impossible but the complexity quickly adds up. |
bb84a42
to
4dd2205
Compare
I agree. Not sure if there's much to discuss here, only a judgement call to make. @adamgundry let's get the committee involved? |
This proposal doesn't feel right to me, and I've been trying to work out why. I think of If we take the rule to be "leftmost outermost first" rather than "strictly left-to-right", does that correctly describe the current behaviour, or are there still inconsistencies? Because if that is always the current behaviour, I would be inclined to accept it as the correct specification and update the docs accordingly. Or are there more compelling motivations for the change than a desire for tidiness? |
OK, perhaps it's not very elegant, but I don't think we can use the abstract syntax tree to guide us either. Its nodes don't have an inherent ordering at all. There isn't any reason to say that in an application As far as the abstract syntax is concerned, I tend to think of Of course we could pick an arbitrary ordering and stick to it, e.g. we could postulate that function applications are ordered
Well, what about
It's mostly a desire for tidiness. We were in the process of a major refactor of implicit quantification and spotted this inconsistency. |
I agree this is a bugfix. (I do think it's appropriate for the committee to consider, because of the backward-compatibility impact.) Let's do it. Authors of code that care can always explicitly quantify, though admittedly consumers of such code have no good way to fix the problem if they are hit by it. |
I sympathise with this, but any specification amounts to specify some linearisation of the tree. Your mental linearisation puts the function of (a If you want another order, use explicit Back-compat:
Moreover, deprecation would be a pain to implement. I think we should just do this. |
Ah, I just realized that I forgot to ping here. I am the sheperd for this RFC and I suggested acceptance as is to the committee. I will wait for another few days to collect opinions. |
…-order.rst Rename file for acceptance.
This proposal has been accepted by the committee. Thank you @int-index! |
This proposal changes the order of implicit quantification for type variables occurring (1) as type operators
a `op` b
, (2) in multiplicity annotationsa %m -> b
.It is essentially a bugfix. However, it is also a breaking change, so we wish to bring the attention of the committee to it in order to discuss the appropriate migration strategy.
Rendered