Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What’s the difference between a union type and a disjoint union type? In that C# proposal I couldn’t tell which syntax was which branch of your dichotomy.


disjoint union is sum type / enum / algebraic data type. Defined at the point of declaration. Each case is distinct (hence, disjoint)

union is what Typescript has. Defined at the point of use. Cases need not be distinct.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: