roc icon indicating copy to clipboard operation
roc copied to clipboard

Feature request: empty containers to end type recursion

Open ageron opened this issue 1 year ago • 0 comments

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.

ageron avatar Sep 22 '24 21:09 ageron