Conversation

Reminder: the way to remember the difference between sum and product types is to count the number of possible values. enum { A(int), B(int) } is a sum type because there are INT_MAX+INT_MAX possible values. (int, int) is a product type because there are INT_MAX*INT_MAX values.
6
116
Initially I was confused when I read TAPL and saw that it went to set theory almost right away. Then I started thinking about types as describing the "set of values a variable may take". And now this, and sum/product types makes sense.
1
8
I feel like I have a decent grasp of type theory, but tbh I still find this specific issue kind of finicky. I often find that type theorists can be insistent that certain interpretations of things are Definitely Wrong, even though they appear isomorphic to the ones they prefer.
1
Show replies