Refinement of tag unions #5504
Labels
enhancement
New feature or request
intermediate issue
Likely good for someone who has completed a few other issues
type checking
We'd like to implement Union Refinement, a proposal to bring flow-typing-style semantics to Roc. This feature would allow typing code like
whereas the current implementation of Roc would type
other
as[User, Admin, SuperAdmin]
.It's expected that this feature will provide a more natural feel to the behavior of tag unions, similar to how a developer may have experienced unions in other languages - particularly those with structural subtypes!
The full proposal and implementation description is provided in this document: https://rwx.notion.site/Union-Refinement-5bef5072afb84675948f89525a25dbb7. See also this Zulip ideas topic for discussion on the proposal: https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/Narrowing.20types.20in.20when.20expressions.
If you'd like to help out implementing this, please don't hesitate to reach out in the #contributing channel in the Roc Zulip!
The text was updated successfully, but these errors were encountered: