-
Notifications
You must be signed in to change notification settings - Fork 338
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
Agda forgets parameter names in function types #5695
Comments
Thanks for reporting! I can reproduce the problem on my system. Here's a minimized version that doesn't depend on the standard library, for testing purposes: open import Agda.Builtin.Bool
open import Agda.Builtin.List
open import Agda.Builtin.Nat
open import Agda.Builtin.Unit
open import Agda.Builtin.Reflection
macro
printType : Term → TC ⊤
printType hole = bindTC (inferType hole) λ t → typeError (termErr t ∷ [])
test1 : (a : Nat) → Nat
test1 = {! printType !}
test2 : (a : Bool) → Bool
test2 = {! printType !} Two interesting things to note:
This is quite an interesting one. |
Actually when you just load the file without running any macros, you can already see that something is wrong: ?0 : Nat → Nat
?1 : Bool → Bool Agda seems to have forgotten the name that was used in the function type. EDIT: Although that doesn't explain the difference between |
Not really, but it decides to print Pi-types as non-dependent if they are non-dependent: agda/src/full/Agda/Syntax/Translation/InternalToAbstract.hs Lines 529 to 531 in 756ac77
|
Right, you are correct. The fact remains that you should be able to access the name that the user gave from the reflection API even if it is not shown when printing the type. (On a side note, perhaps we should print the type as the user gave it instead of discarding the name annotation??) |
Hi! I'm currently working on macros in Agda, and it appears that the names of parameters in function types are lost in some cases. This observation was made when using Agda interactively.
The code below defines a macro that prints the normalised type of the hole it acts on, and then returns a message indicates the macro has finished. Loading the file, placing the cursor in the holes, and triggering the Elaborate and Give command to execute the macro results in the following output to the debug buffer:
(z : ℕ) → ℕ
for the first two holes.(a : ℕ) → ℕ
for the last hole.It appears that the name is erased from the first type,
(a : ℕ) → ℕ
. The second type does not specify a name for the parameter, so I assume Agda automatically fills it in. The third type retains the parameter name.Is this intentional behavior, a bug, or something else? If desired, I also have a version that demonstrates the issue without the debug buffer 🙂
Information
Agda version: 2.6.2
Platform: Ubuntu 20.04 on WSL2, Windows 10 x64
The text was updated successfully, but these errors were encountered: