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

Beta-normalization: Sort the fields of a record projection #625

Merged
merged 9 commits into from
Jul 14, 2019
Merged

Beta-normalization: Sort the fields of a record projection #625

merged 9 commits into from
Jul 14, 2019

Conversation

sjakobi
Copy link
Collaborator

@sjakobi sjakobi commented Jul 5, 2019

Closes #622.

@sjakobi
Copy link
Collaborator Author

sjakobi commented Jul 5, 2019

I tried to follow the other examples of sorting judgments in the document. Not sure whether I got it right…

@@ -0,0 +1 @@
λ(x : { a : Bool, b : Bool, c : Bool }) → x.{ a, c }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@sjakobi
Copy link
Collaborator Author

sjakobi commented Jul 7, 2019

I hope this makes more sense!

t₀.{ x } ⇥ t₁.{ x }


t₀.{ xs₀… } ⇥ t₁.{ x₀, xs₁… }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to do this by induction, because there is nothing to normalize in the set of fields (since they are keys, not Dhall expressions). Rather than these two judgments, I think you only need something like this:

t₀ ⇥ t₁   sort(xs₀) = xs₁
─────────────────────────
t₀.{ xs₀ } ⇥ t₁.{ xs₁ }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that's much better! Should we change the keys operator used below to be similarly abstract? (And use = instead of ?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The keys function expects a record as its argument, whereas the set used for projection is not a record.

It's not clear where you want to use = instead of

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear where you want to use = instead of

In keys(ss…) ⇥ ss₁…, ss₁… isn't an expression so maybe it would be better to write keys(ss…) = ss₁….

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sjakobi: Oh yeah, the keys function should be using just =

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have opened #642 to fix the keys usage.

@sjakobi sjakobi merged commit ce6153a into dhall-lang:master Jul 14, 2019
@sjakobi sjakobi deleted the 622-sort-projection-fields branch July 14, 2019 22:41
sjakobi added a commit to dhall-lang/dhall-haskell that referenced this pull request Jul 14, 2019
sjakobi added a commit to dhall-lang/dhall-haskell that referenced this pull request Jul 15, 2019
sjakobi added a commit to dhall-lang/dhall-haskell that referenced this pull request Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Normalization of record projection
4 participants