Skip to content
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

Problem with DISPLAY pragma for in Data.Empty #2493

Open
jamesmckinna opened this issue Oct 4, 2024 · 6 comments
Open

Problem with DISPLAY pragma for in Data.Empty #2493

jamesmckinna opened this issue Oct 4, 2024 · 6 comments
Labels
bug status: blocked-by-issue Progress on this issue or PR is blocked by another issue. upstream Changes induced by Agda upstream
Milestone

Comments

@jamesmckinna
Copy link
Contributor

jamesmckinna commented Oct 4, 2024

Agda issue#7533 and its 'resolution'/explanation via Agda issue#2004 suggests that perhaps we should rethink our approach to how to deal lexically with the token (for output as well as input)? Or else (at least!) document that Data.Irrelevant should be approached with caution...

Sadly, syntax declarations are subject to the same, or similar, effects, so attempting to write

syntax Irrelevant Empty =

is both ill-formed (the 'hole' Empty is never used), and useless (Empty is not correctly interpreted as a already-defined term).

Perhaps a solution is simply to remove the DISPLAY pragma altogether?
UPDATED: NB. this is the only use of the pragma in stdlib!

@MatthewDaggitt
Copy link
Contributor

Hmm, this is very irritating. It's a big usability loss to remove the DISPLAY pragma... I really don't want Irrelevant Empty popping up in people's buffers...

Introduced by @gallais in 367e3d6. Can't exactly revert this either, as it'll break a lot of code.

@gallais any ideas?

Could we use the new abstract feature somehow to prevent reduction?

@gallais
Copy link
Member

gallais commented Oct 7, 2024

Could we use the new abstract feature somehow to prevent reduction?

This is what I was going to suggest we should experiment with.

However the following does not typecheck and so it does seem that Agda's emptyness check
refuses to go under abstract types which would make it a dramatically breaking change.

data Empty : Set where

abstract

  ⊥ : Set
  ⊥ = Empty


⊥-elim : ⊥ → ∀ {a} {A : Set a} → A
⊥-elim ()

I've commented on an upstream issue bringing up a similar issue for positivity annotations:
agda/agda#6970 (comment)

@jamesmckinna
Copy link
Contributor Author

jamesmckinna commented Oct 7, 2024

Andreas has reopened my originating issue, so there may be upstream progress at some point agda/agda#7536 ... in the meanwhile, display pragma is a new label on the main Agda issue tracker...

Separately, he hinted that perhaps REWRITE could be used here, but I'm not clear whether or not any such attempt would be subject to the same interpretation of Empty as a (pattern) variable...

@jamesmckinna
Copy link
Contributor Author

jamesmckinna commented Oct 7, 2024

As for pragmatics of the problem, I only encountered it when trying to have Data.Empty and Data.Irrelevant in scope at the same time... a (perhaps) rare scenario? (And leaning in to my customary observation about explicit use of and ⊥-elim when these are largely avoidable via other mechanisms...)

@andreasabel
Copy link
Member

Prompted by this issue, Agda 2.8 might have more usable DISPLAY pragmas:

This should fix your problem (albeit not right now).

@MatthewDaggitt
Copy link
Contributor

That's great, thank you! So I guess we mark this issue as blocked upstream and wait for the fix.

@MatthewDaggitt MatthewDaggitt added upstream Changes induced by Agda upstream status: blocked-by-issue Progress on this issue or PR is blocked by another issue. labels Oct 9, 2024
@MatthewDaggitt MatthewDaggitt added this to the Agda v2.8.0 milestone Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug status: blocked-by-issue Progress on this issue or PR is blocked by another issue. upstream Changes induced by Agda upstream
Projects
None yet
Development

No branches or pull requests

4 participants