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

Feature request: empty containers to end type recursion #7114

Open
ageron opened this issue Sep 22, 2024 · 0 comments
Open

Feature request: empty containers to end type recursion #7114

ageron opened this issue Sep 22, 2024 · 0 comments

Comments

@ageron
Copy link
Contributor

ageron commented Sep 22, 2024

To create a tree structure, I would like to be able to write:

Tree : { name: Str, other: U64, children: List Tree}

Right now this fails because the compiler could thinks it's an infinitely récursive type. But clearly an empty children list can end the recursion. In fact, any container type that can be empty should be able to end the recursion.

This feature would make many recursive types like this one much more pleasant to work with. Right now I have to use two tags, and my code is littered with when, most of which serve no purpose other than ignoring the Empty tag.

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

No branches or pull requests

1 participant