-
Notifications
You must be signed in to change notification settings - Fork 257
agda/agda#7674 eta-expand fields in record expression #2546
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
Agda PR #7674 requires some implicit arguments explicitly in some record expression given since variance info got refined (invariant to non-variant) and hence solutions are no longer unique.
src/Algebra/Construct/Initial.agda
Outdated
|
||
isMagma : IsMagma _≈_ _∙_ | ||
isMagma = record { isEquivalence = isEquivalence ; ∙-cong = ∙-cong } | ||
isMagma = record { isEquivalence = isEquivalence ; ∙-cong = λ {y = y} {v = v} → ∙-cong {y = y} {v = v} } |
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 checks with Agda master (2.8.0) but not with 2.7.0.1:
_x_48 ≈ y → _u_49 ≈ v → _x_48 ∙ _u_49 ≈ y ∙ v !=
{v = v₁ : Carrier} → x ≈ y → v ≈ v₁ → x ∙ v ≈ y ∙ v₁ because one is
an implicit function type and the other is an explicit function type
when checking that the expression
λ {y} {v} → ∙-cong {y = y} {v = v} has type Congruent₂ _≈_ _∙_
Apparently, in 2.8.0 we have fixed another bug but I could not find it now.
@andreasabel IIUC, as this is an |
Formally, yes. However, in this case the change is in its present form compatible both with current Agda and 2.8.0, and it does not change the value of any definition, only makes some arguments explicit, so I thought we could just merge this into |
@andreasabel your definition of "Current Agda" is v2.7.0, or v2.7.0.1? If the former, then the module continues to typecheck as-was under 2.7.0, and IIUC from @MatthewDaggitt 's v2.2rc1, also under 2.7.0.1. It may very well be that v2.8.0 fixes bugs which mean that eta-expansion of implicit functions is required in record field bindings, but in my own (not so very) humble opinion, this should be regarded as a major UX failure. The changes in this PR concern a single module within which it will no longer be possible, IIUC (please correct if otherwise) to exploit record subtyping in order to construct the relevant instantiations of the various initial name : type
name = defn
... = record { name = name } when the shared type How can this make sense to users? And FTR, there are other examples in the One reason I nudged towards |
For
|
My feeling is that this should also go on experimental. As @jamesmckinna says this seems like a downgrade in the library code (even if backwards compatible). Furthermore, if Agda 2.8.0 is released, it'll make creating a clean release of the standard library much easier than if this is buried on |
Adding my voice to the chorus in favour of |
Ok, I merged this into experimental. @jamesmckinna wrote:
Here is some background on this PR:
We are all aware that eager insertion of implicits leads often to annoying eta expansions like A final note: Not having eager insertion of implicits would be annoying as well, e.g. for the standard |
@andreasabel thanks for the detailed account of what is going on under the hood regarding eta-expansion in the setting of (undecidable!) typechecking of Agda's surface syntax. Once v2.8.0 gets released, I'd be happy to revisit this for |
Rebased |
agda/agda#7674 eta-expand fields in record expression
Agda PR #7674 requires some implicit arguments explicitly in some record expression given since variance info got refined (invariant to non-variant) and hence solutions are no longer unique.
Fixing Agda to commit 2ffb002 now in agda/agda#7674.
If this PR is rebased or squashed (rather than merged with merge commit) the commit hash there needs to be updated accordingly.