Conversation
Arguably it might be nice to retain names (e.g. prefixed by an |_|) when the dot pattern isn't provided explicitly, but this info does not appear to be retained by the time we reach internal syntax
|
Ah indeed, ideally Agda would keep track of the names of patterns corresponding to module parameters in the |
Still a bit imperfect: names corresponding to module parameters are not prefixed by '_'s because these are generated purely based of the type, while explicitly named dot patterns can have '_'s prefixed
|
Yes good point - I did not look very carefully, my bad. The naming behaviour on this PR is now (as of the above commit):
I like the idea of prefixing with compiles to invalid Haskell Because of this, I'm somewhat inclined to just use the names as-given (easier, and lower chance of weird edge cases) |
This stays consistent with the behaviour on module parameters and has less chance of weird edge-cases
I got rid of the pattern lambdas to make them, so the test name doesn't really make sense anymore
|
After thinking about it for a bit I agree that prefixing names with |
e58fe32 to
34b1d0f
Compare
Rather than trying to extract the dot pattern name with nameOf, we make use of the PatOrigin in PatternInfo
34b1d0f to
b63f7f3
Compare
|
I agree, but I think there is another case: the user wrote a variable, but this got elaborated into a dot pattern, e.g.: checkSubst' : ∀ {@0 x α β} (t : Telescope α (x ∷ β)) (ty : Bool) (rest : Telescope (x ∷ α) β) → @0 t ≡ ExtendTel ty rest → Bool
checkSubst' t ty rest refl = TrueFor these, the origin is And actually, module parameters are compiled earlier (via |
|
I thought perhaps with your changes we would get rid of |
|
Please let me know if there are no further changes you want to make to this PR so I can merge it. |
|
Ah fair, yeah for now I don't think there is any need to remove |
As of #439 it is actually correct behaviour for some clauses with dot patterns to get compiled to Haskell code (specifically when the argument is compiled to a term argument in Haskell - i.e. there is no dependent quantification).
Names given by the Agda programmer are retained where possible, but explicit dot patterns are just turned into wildcards
OLD:
Arguably it might be nice to retain names (e.g. prefixed by a
_) when the dot pattern isn't provided explicitly, but this info does not appear to be retained by the time we reach internal syntax (I could certainly be missing something though)