-
Notifications
You must be signed in to change notification settings - Fork 57
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
Named arguments #2250
Merged
Merged
Named arguments #2250
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90cbfa4
to
94d07d7
Compare
commit a9fd159 Author: Jan Mas Rovira <[email protected]> Date: Fri Jul 14 17:33:53 2023 +0200 ormolu commit c5a312b Author: Jan Mas Rovira <[email protected]> Date: Fri Jul 14 17:32:22 2023 +0200 improve message commit 108c353 Author: Jan Mas Rovira <[email protected]> Date: Fri Jul 14 17:27:04 2023 +0200 test commit fbaeadd Author: Jan Mas Rovira <[email protected]> Date: Fri Jul 14 16:19:13 2023 +0200 add test commit 94d07d7 Author: Jan Mas Rovira <[email protected]> Date: Fri Jul 14 15:06:15 2023 +0200 optional delims commit cb767c3 Author: Jan Mas Rovira <[email protected]> Date: Fri Jul 14 12:24:10 2023 +0200 add error message for missing arguments commit 617bc01 Author: Jan Mas Rovira <[email protected]> Date: Fri Jul 14 09:57:44 2023 +0200 handle ambiguous iterators commit 6e0370e Author: Jan Mas Rovira <[email protected]> Date: Fri Jul 14 07:43:44 2023 +0200 fix bugs and add errors commit fabe021 Author: Jan Mas Rovira <[email protected]> Date: Thu Jul 13 19:14:31 2023 +0200 fix commit 398c682 Author: Jan Mas Rovira <[email protected]> Date: Thu Jul 13 17:07:03 2023 +0200 debugging commit b9c41c5 Author: Jan Mas Rovira <[email protected]> Date: Thu Jul 13 15:21:51 2023 +0200 wip commit 243d2f7 Author: Jan Mas Rovira <[email protected]> Date: Thu Jul 13 01:42:37 2023 +0200 translating named args commit a4553a4 Author: Jan Mas Rovira <[email protected]> Date: Tue Jul 11 19:35:27 2023 +0200 wip commit 9854f64 Author: Jan Mas Rovira <[email protected]> Date: Tue Jul 11 17:22:42 2023 +0200 add named signature builder commit e94631d Author: Jan Mas Rovira <[email protected]> Date: Tue Jul 11 00:45:31 2023 +0200 wip commit f912bee Author: Jan Mas Rovira <[email protected]> Date: Mon Jul 10 19:29:23 2023 +0200 ambiguousiteratortype commit a872a39 Author: Jan Mas Rovira <[email protected]> Date: Mon Jul 10 18:31:40 2023 +0200 wip commit 5de2cf1 Author: Jan Mas Rovira <[email protected]> Date: Mon Jul 10 16:54:13 2023 +0200 style
a9fd159
to
d2dc48d
Compare
paulcadman
approved these changes
Jul 18, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌟
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pr implements named arguments as described in #1991. It does not yet implement optional arguments, which should be added in a later pr as they are not required for record syntax.
Syntax Overview
Named arguments are a convenient mehcanism to provide arguments, where we give the arguments by name instead of by position. Anything with a type signature can have named arguments, i.e. functions, types, constructors and axioms.
For instance, if we have (note that named arguments can also appear on the rhs of the
:
):With the traditional positional application, we would write
With named arguments we can write the following:
fun (f := suc) (x := zero)
.fun (x := zero) (f := suc)
.fun (x := zero; f := suc)
.fun (f := suc) zero
.fun {A := Nat; B := Nat} (f := suc; x := zero)
.fun {B := Nat} (f := suc; x := zero)
.What we cannot do:
fun (x := zero)
.fun (A := Nat; f := suc)
fun (f := suc; x := zero) {A := Nat}
.