The wikipedia articles are terribly written (for math loves or people who just need to refresh their knowledge).

What is a “sum” of types? What is a product of types? Is it possible to Cat x Dog or Cat + Dog? What does that even mean?

  • xigoi@lemmy.sdf.org
    link
    fedilink
    arrow-up
    5
    ·
    3 months ago

    Union types and sum types are two distinct concepts. Int | Int is the same type as Int, but Int + Int is not the same type as Int.