-
Notifications
You must be signed in to change notification settings - Fork 339
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
Option to erase record parameters in record module without erasing them as arguments to the type #5770
Comments
As I wrote elsewhere I think we should wait a bit until we have more practice writing code like this. We can already express what you want to express, except that you might not be able to use certain names. I saw that there is a bug in agda2hs that you want to fix. Perhaps it makes sense to change Agda in order to fix this bug, but I don't think we should rush things. Currently record modules are strange: the parameters are not erased in the telescope of a record module, but when you open the module you get projections with erased parameters (#4786 (comment)). The design would arguably be cleaner if we always erased the parameters, but that would break existing code. I suggest that we run some experiments, and see how much code breaks in practice. If most code is still accepted, then we could perhaps go with the clean design. |
The problem with "waiting until we have a bit more practice" is that this issue is currently preventing me from experimenting further with using Technically I can work around the problem, however it requires me to:
I can do these things myself, but they make it extremely annoying to add I am not opposed to running some experiments to see what would happen if we always erased parameters (i.e. turn on the |
If agda2hs relies on the use of this option, not only in the implementation of agda2hs, but also in the Agda code, isn't there a risk that we will have to support it to ensure backwards compatibility? I'm fine with adding the option temporarily, use it for testing, and then evaluate it before we release the next version of Agda. (By the way, I suspect that lots of code in the standard library will fail with this option turned on.) |
I could create a separate branch of Agda2Hs for testing out this new flag, but keep the main version as it is until and unless we decide to keep the behaviour of |
Regarding the standard library: It is the kind of change that only works when you consistently annotate arguments with |
…es that use {{...}} syntax
…es that use {{...}} syntax
Sure.
If you use {-# OPTIONS --without-K #-}
module _ where
open import Agda.Builtin.Equality
module Fails {@0 A : Set} {@0 P : A → Set} where
subst : {x y : A} → x ≡ y → P x → P y
subst refl p = p
|
…es that use {{...}} syntax
…es that use {{...}} syntax
…es that use {{...}} syntax
…es that use {{...}} syntax
…es that use {{...}} syntax
…es that use {{...}} syntax
…es that use {{...}} syntax
As noted in #5769, it would be useful to have an option (either a global flag or a record keyword) to mark the parameters of a record module as being erased (as in having a
@0
annotation) without marking the arguments to the record type itself as erased.This would mean for example that the following code should be accepted:
... and the following code should be rejected:
For some motivation for why I think we need this feature, see agda/agda2hs#88
The text was updated successfully, but these errors were encountered: