|
|
|
|
|
by fooyc
1537 days ago
|
|
The article is well written and Haskell appears to have what’s necessary to work efficiently with algebraic data types (matching and overloading). But in the end, it’s just fancy words for union and intersection types, or am I missing something ? |
|
(The "sum" and "product" are why they're called "algebraic". You can also analyze them as power series, such as in computing derivatives for zippers)
Intersection types are something else (that Haskell does not have built in to my knowledge).
"union" is slightly imprecise, because sum types are tagged (i.e., a non-discriminated union of Int and Int is just Int, but Int+Int is actually the same as (Bool, Int). True non-discriminated union types are relatively uncommon in static type systems, but TypeScript for example does have them)