this post was submitted on 11 Apr 2024
10 points (91.7% liked)

No Stupid Questions (Developer Edition)

936 readers
1 users here now

This is a place where you can ask any programming / topic related to the instance questions you want!

For a more general version of this concept check out [email protected]

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
 

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?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 5 points 7 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.