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.
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
Record projection by expression #499
Record projection by expression #499
Changes from 6 commits
cd1e4f2
db021b9
df19193
f5e109c
ae4a168
f69e49b
6185c96
4786493
8bbd6fc
e340791
d743135
2dfa774
123ebc8
5c92ee8
e4d7928
94cf52e
6f37451
3d43c8a
1c07554
0cc72ea
dedf45e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Don't need this line at all, since the below (once switched to label
10
) is just a second rule for the above decoding anyway.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.
Perhaps add some prose here explaining that the
e.(t)
syntax lets the user select record fields by type. Currently there isn't any text in the standard explaining this featureThere 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.
This judgment needs to somehow enforce that
{ ts… }
and{ ss… }
are syntactically record types. One way to do that is define the judgment via induction (i.e. define a judgment to type-check the case where the two record types are empty and then define a judgment to type-check the case where the two record types are non-empty), like this: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.
@Gabriel439 For the base case, we can relax the requirement on
e
, since it is still sound, in the same universe, to project empty record from any record.Also, do you think that the following induction step make sense?
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.
The concern is with the induction step that you suggested earlier, in which
Γ ⊢ s : T
andΓ ⊢ e.({ xs₁… }) : T
cannot reconcile.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.
@Nadrieril: Oh yeah, the base case doesn't need to require that
e
is the empty record. That's a mistake on my part. Good catch!Also, you're right that the two occurrences of
T
in the induction judgement should be distinct. That's another mistake on my part.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.
missing newline
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.
Same here.
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.
type annotation on the end here seems unneeded?
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.
missing newline
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.
dhall format
automatically removes the new line when I add it.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.
this should be named
A
and have aB
part with it -- thelet
seems like a lot of extra noise for a unit test.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.
Note that we should still have a test like this one, even if not necessarily for a unit test. It's important to test that type inference works when the
s
is an abstract type since that's a likely case that an implementation might implement incorrectly.