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

dhall-json: Nesting: Support empty alternatives as contents #1204

Merged
merged 3 commits into from
Aug 6, 2019

Conversation

sjakobi
Copy link
Collaborator

@sjakobi sjakobi commented Aug 5, 2019

Closes #1201.

alternativeName
)
contents
, contents
)
, ( "field"
Copy link
Collaborator Author

@sjakobi sjakobi Aug 5, 2019

Choose a reason for hiding this comment

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

The additional indentation here confused me for so long, I ended up opening a GHC issue! ;)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, the indentation there bugged me, too 🙂

)
contents
] | isInlineNesting nesting
, Just (alternativeName, Just (Core.RecordLit kvs)) <- getContents contents -> do
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 wonder whether we should report an error in this case:

Suggested change
, Just (alternativeName, Just (Core.RecordLit kvs)) <- getContents contents -> do
, Just (alternativeName, Just notARecordLit) <- getContents contents -> do

Non-record alternatives are supported with Nested, so users might also try them with Inline.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@sjakobi: Yeah, we probably should report an error here. It's up to you if you want to include that in this pull request or not

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'll add the error in a follow-up PR.

alternativeName
)
contents
, contents
)
, ( "field"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, the indentation there bugged me, too 🙂

)
contents
] | isInlineNesting nesting
, Just (alternativeName, Just (Core.RecordLit kvs)) <- getContents contents -> do
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sjakobi: Yeah, we probably should report an error here. It's up to you if you want to include that in this pull request or not

@sjakobi sjakobi merged commit 1d58840 into master Aug 6, 2019
@sjakobi sjakobi deleted the sjakobi/issue1201 branch August 6, 2019 11:24
@wezm
Copy link

wezm commented Aug 7, 2019

Thank you!

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.

Empty alternative does not trigger JSON name preservation
3 participants