Skip to content

Add support for accessing/projecting record type fields #2555

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Gabriella439
Copy link
Collaborator

No description provided.

@Gabriella439 Gabriella439 force-pushed the gabriella/access_types branch from 00b18b8 to a3ffd19 Compare December 3, 2023 04:30
@winitzki
Copy link
Collaborator

What are the conflicts in the git submodule dhall/dhall-lang? Should this branch get updated with the latest dhall-lang?

@winitzki
Copy link
Collaborator

This PR fails with the corner case that I was describing in the discussion here:

 { a : Bool, b : Text }.{}

{=}

 {  }.{}

{=}

If an empty field selection is applied to a literal record type, the result must be {}. In all other cases, the result must be {=}.

@@ -414,6 +417,9 @@ vProjectByFields env t ks =
VRecordLit kvs ->
Copy link
Collaborator

@winitzki winitzki Jun 23, 2025

Choose a reason for hiding this comment

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

Replace:

if null ks
        then VRecordLit mempty
        else case t of

by

case t of
    VRecord _ | null ks -> VRecord mempty
     _        | null ks -> VRecordLit mempty

In this way, { a : Bool } . { } will be correctly reduced to { }.

@winitzki
Copy link
Collaborator

If this branch is too stale, I could prepare another branch with just the code changes (and no changes in the dhall/dhall-lang submodule).

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.

2 participants