Hacker News new | past | comments | ask | show | jobs | submit login

The Union of Int and Int is exactly Int; the Sum is not.

The union of two types contains all values that are in either component type. The sum of them contains all of the values of the first type, each one associated with a tag like “I came from the left side” plus all of the elements from the second type with a similar tag.

The Union of Bool and Bool has 2 values, the Sum has 4.

If we define Maybe[A] to be the process of unioning on “null” to the values of A then Maybe[Maybe[A]] = Maybe[A]. If it’s defined with a Sum then that equation doesn’t hold.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: