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

Add dhall-json support for weakly-typed JSON values #1007

Merged
merged 4 commits into from
Jun 20, 2019

Conversation

Gabriella439
Copy link
Collaborator

Fixes dhall-lang/dhall-lang#409

This matches the standard representation for arbitrary JSON proposed in
dhall-lang/dhall-lang#586

This change supports conversions in both directions (from JSON/Type to
JSON and back)

Fixes dhall-lang/dhall-lang#409

This matches the standard representation for arbitrary JSON proposed in
dhall-lang/dhall-lang#586
@Gabriella439 Gabriella439 merged commit da08543 into master Jun 20, 2019
@Gabriella439 Gabriella439 deleted the gabriel/decode_value_2 branch June 20, 2019 01:19
> let JSON = https://prelude.dhall-lang.org/JSON/package.dhall
>
> in JSON.object
> [ { mapKey = "foo", mapValue = JSON.null }
Copy link
Member

Choose a reason for hiding this comment

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

This ship has probably sailed now, but it's a little strange to me that we call it an object in the constructor, but the elements talk about a map. object with propertyKey/propertyValue might have been better, as objects have properties, rather than maps (they are maps).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ocharles: The names for the constructors are based on the official grammar for JSON: https://www.json.org/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, I misunderstood your comment. The reason for still using mapKey/mapValue is so that once we support the toMap keyword, we can do this:

let JSON = https://prelude.dhall-lang.org/JSON/package.dhall

in  JSON.object (toMap { foo = JSON.number 1, bar = JSON.number 2 })

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.

[Help Request/Doc Clarification] Translating recursive optional types
2 participants