-
Notifications
You must be signed in to change notification settings - Fork 26
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
Dependent Records (first pass) #24
Comments
Following are some rules for the above. For the moment I'll assume there is a Conv rule somewhere, so I'll leave out any normalisation that might be needed later. Also, I'll use
A rule for this (fairly standard, I think) is
I'm not sure how typical this one is. Is the value usually available for later field values? In any case:
Right. This can be written out as follows:
where the functions are defined as:
As an example, say you're in a context where:
I'm using double braces here to indicate that the size argument needs to be elaborated. Given this, the following term should typecheck:
The two arguments have type |
Awesome!
Yeah, me neither - but I think it is nice from an ergonomics perspective. It think it's allowed in Agda at least.
Where does Gonna see if I can try to avoid substitution, as per this blog post - I've pretty much got it eliminated from the rules right now. Would be interesting to see if we could transform these rules to avoid it too. 🤔
My plan at the moment is to use |
Yes, sorry. I've edited my original post to fix that.
That's a good idea when formulating the operational semantics, which I think is what that article is written in relation to. Personally I like to start off with rules in the declarative style, since it's easier to check that they mean what you think they mean, and from there proceed to an operational semantics (i.e., syntax-directed rules) using the declarative rules as a guide. But I realise some people like to head straight for an operational semantics in one go. So, yes, it remains to be figured out how to make the rules bidirectional, where to normalise, how to implement substitution, etc. |
For comparison, the version of the rule that doesn't allow this is:
That is, we don't add |
This is a cut down set of requirements for dependent records, in contrast to the more lofty goals described in issue #2.
The following additions will be made to the core syntax:
Record { x : I8, y: I8 }
will not be compatible withRecord { y: I8, x : I8 }
, andrecord { x = 1, y = 2 } : Record { x : I8, y: I8 }
is a type error.The text was updated successfully, but these errors were encountered: