Hacker News new | ask | show | jobs
by curtisf 1541 days ago
"Algebraic data types", as they appear in Haskell, are recursive sums of product types.

(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)