-
Notifications
You must be signed in to change notification settings - Fork 72
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
Refactor library to use λ where
#809
The head ref may contain hidden characters: "\u03BB-where"
Conversation
I also remembered that we don't actually have a script focused on best practices for agda code, and I won't bother making one now just for this convention. |
This one's ready now. At some point in the future, when there are fewer pull requests in the pipeline, I'd like to go through the repository to change most instances of
|
Aren't there some instances where |
I agree, when both arguments span multiple lines*, I think x ,
y
z
w So if you want, I can restrict to only replacing instances where both arguments of |
I feel like we should still include some guidelines about what options we have to type-set lambdas. Eg we could mention that we always wrap the lambda-expression in parentheses, even if it is the last argument of a function and therefore not strictly required. Then we could mention that there are several lambda-styles available:
and we could mention that whenever lambdas 2-4 appear in an entry we mark it as abstract. We could also mention that while these fancy lambdas are permitted in our code, in many common situations it might be preferable to factor out that lambda-expression into a separate definition. And then we could also say that the formatting guidelines for these lambdas are not quite cleared up yet, just to be upfront. |
@VojtechStep also mentioned some lambda-styles that we don't use in our library. I already forgot about them, but we could include those too in our style guide and say that we don't use them. |
I don't think this is technically a pattern-matching lambda - it's only allowed for record types with eta equality (which, to be fair, covers many of our use cases, except path induction). |
Co-authored-by: Egbert Rijke <[email protected]>
The conventions you use for |
Am I correct that @VojtechStep intended to update the guidelines regarding pattern-matching lambdas, or did you want me to do it here? |
I don't know if Vojtech was planning to do that, but since this PR introduces lambda-where globally to the library, the natural PR to include some formatting guidelines seems to be this one. |
Okay, that makes sense. And then I guess he will write the guidelines for the other proposed instance where he wanted to use pattern-matching lambdas. |
lambda where
λ where
I changed the title back because I don't think it should cause trouble. If it does, then we need to address that another way in any case I think. |
Strange! Do you know why it is getting slow? |
IDK, my guess is a large code base. Maybe it would be a good idea to keep a log of type-checking time for the whole library after each PR to keep a watch on it |
Do you mean that it is generally taking a long time to compile the library, or that something in this PR happened that makes it take longer to compile? |
Hard for me to say if it's gotten slower with this PR. It may just be that I'm type-checking a lot while working on this PR, hence noticing the slow |
Let me know what you think of the new convention |
Beautiful! |
Co-authored-by: Egbert Rijke <[email protected]>
Co-authored-by: Egbert Rijke <[email protected]>
Also adds a new rule removing blank lines right before
where
keywords.