News for hackers. Stuff that matters.
Re:Algebraic Data Types for C99 by Twisol on Monday May 20, 2024 @08:17PM (#40422390)
> substitute error with whatever type you want there - null, Error, or your own thing

And if I want `error` to be `string` so I can just provide an error message? Proper disjoint sum types let me keep the two sides disjoint, even if they happen to be the same type. Union types will collapse on any overlap, so if I happen to instantiate `error` at `string` then I can no longer tell my error case from my data case.

There are no comments on this comment yet.