4 ms·
Without generics, sum types would have to be a built-in like maps and arrays. With generics, discriminated unions can take on all sorts of user-defined shapes.
by OceanSpray 6y ago
Without generics, sum types would have to be a built-in like maps and arrays.
With generics, discriminated unions can take on all sorts of user-defined shapes.
- kccqzy 6y agoWithout generics, structs can take on all sorts of user-defined shapes. It's just that the types of its fields are fixed at declaration. Without generics but with sum types, the sum types can still take on all sorts of user-defined shapes. It's just that the types of its various alternatives are fixed at declaration.