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

Yes, a “Sum” type in Type Theory


Well it's more like a dynamically defined sum type, no?

There's also the scaffolding around it, like the way error codes compare for equivalence[1] against error conditions in a symmetric way[2].

The result is you can easily add new a domain-specific error category, and error codes using your new category can be fed to existing code and they'll do something sensible without further modification. Your code with the new category could even be loaded at runtime[3].

Not something you can do with plain sum types, ie tagged unions in C. At least as far as I know, though I'm no expert.

[1]: https://www.boost.org/doc/libs/1_82_0/libs/system/doc/html/s...

[2]: https://www.boost.org/doc/libs/1_82_0/libs/system/doc/html/s...

[3]: though there might be dragons, see my previous reference




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: