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

Python representation of Optional and Unions #6

Open
s-zeng opened this issue Nov 11, 2020 · 2 comments
Open

Python representation of Optional and Unions #6

s-zeng opened this issue Nov 11, 2020 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@s-zeng
Copy link
Owner

s-zeng commented Nov 11, 2020

We should have types/objects in Python that we can use to serialize into dhall unions. Optionally, we can have a flag that lets dhall deserialize into such types.

i.e. desired ux should be something like:

>>> import dhall
>>> dhall.dumps([dhall.Some(5), None])
'[Some 5, None Natural]'
@s-zeng s-zeng added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Nov 11, 2020
@nickray
Copy link

nickray commented Feb 26, 2021

There are several Python libraries that implement Options and Results in the Rust style. Maybe one of those should be used? Although it seems (to me) there's no clear winner one should pick.

@s-zeng
Copy link
Owner Author

s-zeng commented Feb 27, 2021

There's no clear winner, and it's also quite easy to implement ourselves on the python side. It'll just take some fiddling on the rust-side to get it to line up w/ whatever data struct we choose. I can look into this when I have a bit more time but until then I'll probably defer to the choice of whoever submits a working PR

@s-zeng s-zeng added this to the v1.0.0 milestone Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants