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

Asymmetry between --omit-empty and --omissible-lists #1488

Open
sjakobi opened this issue Oct 30, 2019 · 3 comments
Open

Asymmetry between --omit-empty and --omissible-lists #1488

sjakobi opened this issue Oct 30, 2019 · 3 comments

Comments

@sjakobi
Copy link
Collaborator

sjakobi commented Oct 30, 2019

In #1475 @astynax discovered the following asymmetry between --omissible-lists on the dhall-to-{json,yaml} side and --omit-empty in {json,yaml}-to-dhall:

omit-empty also "nullifies" not only empty arrays but also empty objects. omissible-lists translates only null ~> [] but not null ~> {}. So omit-empty and omissible-lists are not complete opposites.

It would be nice to increase the symmetry, but I'm not sure how…

@astynax
Copy link
Contributor

astynax commented Oct 30, 2019

Can we extend omissible-lists to smth like omissible-collections? This extended form will make empty objects from null as it does for arrays for now.

@sjakobi
Copy link
Collaborator Author

sjakobi commented Oct 30, 2019

Yeah, a generalization like that should work. 👍

Let's see if we can find a better name than --omissible-collections

@sjakobi
Copy link
Collaborator Author

sjakobi commented Nov 12, 2019

Thinking more about this, I find it hard to imagine a situation where you'd use yaml-to-dhall to generate a Dhall config containing {=}, so I'm not sure whether it's worth implementing the missing null -> {=} translation.

I also haven't come up with a better option name than --omissible-collections – so I guess it's good enough! --omit-empty should be kept as a synonym for compatibility though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants