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 Text "no" gets rendered to YAML as a Boolean #2275

Closed
s5bug opened this issue Aug 8, 2021 · 5 comments
Closed

Dhall Text "no" gets rendered to YAML as a Boolean #2275

s5bug opened this issue Aug 8, 2021 · 5 comments

Comments

@s5bug
Copy link

s5bug commented Aug 8, 2021

{ country = "no" -- norway
, foo = false
}

Dhall → Yaml:

country: no
foo: false

A spec-compliant Yaml parser will parse country: no as { country: false } (this can be verified with an online pyyaml api)

I don't use Yaml so I haven't run into this naturally, but I am relatively sure that Dhall Text should become a Yaml String.

@TristanCacqueray TristanCacqueray transferred this issue from dhall-lang/dhall-lang Aug 8, 2021
@TristanCacqueray
Copy link
Collaborator

That seems related to #2192 and you can get around this by using dhall-to-yaml-ng.

I've transferred the issue to the right repository.

@sjakobi
Copy link
Collaborator

sjakobi commented Aug 10, 2021

@s5bug Note that no is not a boolean in YAML 1.2: https://stackoverflow.com/questions/42283732/are-on-and-off-supposed-to-be-interpreted-as-true-or-false-in-yaml-1-2

For compatibility with YAML-1.1 parsers it would be better to quote strings like yes, no, etc., though. Ideally this would happen in aeson-yaml, the YAML-printing library that dhall-to-yaml relies on.

@s5bug
Copy link
Author

s5bug commented Aug 10, 2021

Ah, TIL! Is there some directive to force a YAML file to be parsed using the 1.2 spec?

@sjakobi
Copy link
Collaborator

sjakobi commented Aug 10, 2021

Is there some directive to force a YAML file to be parsed using the 1.2 spec?

That would be nice to have, but I'm not aware of anything like that. :/

@sjakobi
Copy link
Collaborator

sjakobi commented Oct 22, 2021

Closing. If there's anything left to do here, please reopen and clarify what should be done.

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

3 participants