-
Notifications
You must be signed in to change notification settings - Fork 6
Interest in json-to-dhall and yaml-to-dhall? #23
Comments
Yeah. There is a discussion of possible language integration integration: ... but the first step could be implementation of the ideas in that thread as a standalone executable. I think the main consensus from that thread was that any JSON to Dhall conversion would need to specify a type annotation if that's alright with you. In other words, it would be something like: $ json-to-dhall --type './schema.dhall' < ./input.json > ./output.dhall |
Sounds good! |
Giving this some thought, looks like there are a couple ways to approach. Convert and type check together
Convert in passes
Maybe there are other approaches. Do you have a preference? |
Hmm, given that I wonder if there are other cases to account for? |
I assumed that this would require the first approach (Convert and type check together) mainly due to handling |
Sounds good. Also, how should unions work? If you have: < Name : Text > What JSON corresponds to that? What if you have: < FirstName : Text | LastName : Text > |
@joneshf: Yeah, this is one of the tricky bits to deal with. My intuition is either (A) don't support union types at all or (B) take the first union type that matches (doing depth-first recursive search if necessary) I would go with (A) and not support union types for now until the logic for dealing with sum types has been properly formalized. The reason why is that in the process of formalization one algorithm for disambiguating these cases might be simpler and clearer to specify than others and I don't want users to depend on the wrong algorithm until we know which one it is. |
We have programs for taking Dhall and making JSON. Is there any interest in a program that takes JSON and makes Dhall? I often find myself reaching for
jq
as an alternative, but its UX isn't the best for me. Similarly foryq
.Thoughts?
The text was updated successfully, but these errors were encountered: