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

Support dumping empty lists with type annotation #4

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

Support dumping empty lists with type annotation #4

s-zeng opened this issue Nov 11, 2020 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@s-zeng
Copy link
Owner

s-zeng commented Nov 11, 2020

Dumping an empty list currently gives a TypeError. We should support a mechanism to allow empty lists to be tagged with a type.

Example:
Currently, the following fails with a TypeError:

>>> dhall.dumps([[3, 4], []])
TypeError: cannot serialize value without a type annotation: List([])

... but the following works just fine:

>>> dhall.dumps([[3, 4], [5]])
'[[3, 4], [5]]'

To be consistent, we could support type inference in homogeneous lists to add a type annotation to the empty list

@s-zeng s-zeng added the bug Something isn't working label Nov 11, 2020
@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
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant