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

To let or not to let #2369

Open
JacquesCarette opened this issue Apr 17, 2024 · 3 comments
Open

To let or not to let #2369

JacquesCarette opened this issue Apr 17, 2024 · 3 comments

Comments

@JacquesCarette
Copy link
Contributor

Right now, let in Agda generates substitutions (as confirmed by Andreas here amongst other places). The attempted fix for this has stalled even though it is an extremely old issue.

The advice is to favour where over let.

The question is: do we program stdlib to current Agda or some optimistic future Agda that will have a better implementation of let?

Given just how long this has been a wart, I'm of the opinion that being optimistic would be ill-placed (even though I'm actually normally fairly optimistic!)

@gallais
Copy link
Member

gallais commented Apr 17, 2024

FTR, these cannot be turned into where definitions because these get lifted to the
toplevel and that is not done in a modality-respecting way. In other words: turning
these into where definitions leads to errors about irrelevant values being used in
a relevant context.

https://github.com/gallais/agda-stdlib/blob/7947cd42ca813dfc9024bc50552c5cd5ea35f221/src/System/Random.agda#L119-L133

@JacquesCarette
Copy link
Contributor Author

Good point: indeed there are times when we have no choice, because the implementation scheme for where is also sub-optimal.

@jespercockx
Copy link
Member

Unfortunately, Agda currently does not have any way to create a local shared closure: let bindings are inlined, while where declarations are lifted to the top level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants