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

Apparently C# 7 can match discriminated unions quite well[1], with the caveats being:

1. you need a dummy type[2] for empty parts of the union.

2. it still can't enforce exhaustive matching.

[1]: https://stu.dev/pattern-matching-fsharp-union-types-in-cshar...

[2]: Maybe () would work?



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: