News for hackers. Stuff that matters.
Re:Tagged unions, or ‘variants’, in C by tome on Monday June 26, 2017 @06:22AM (#14635592)
The tagged union/variant idea does not correspond to a Haskell type class. In fact it doesn't really even have a name in Haskell it's just the "sum type" aspect of a "algebraic data types" (which constitutes sums, products and functions, basically).
Re:Tagged unions, or ‘variants’, in C by k__ on Monday June 26, 2017 @06:37AM (#14635664)
I see.

I thought that type classes are sum types also.

Re:Tagged unions, or ‘variants’, in C by tome on Monday June 26, 2017 @06:49AM (#14635709)
You can sort of consider them as open sum types which third parties can add additional summands to but that's probably not a very helpful way of thinking about them.