Daniel's working notes

Algrebaic Data Types

In programming, especially functional programming, algrebaic data type is kind of type that is composed from other types. In Swift we have enum and struct as algrebaic data types. enum is kind of sum types meanwhile struct is product types.

Product types allow you to have one or more value on the single structure. value here means possibilities. We can calculate the possibilities by multiplying each of the property inside the structure.

Sum types is a type where the value is one of a fixed set of options.

References:

Linked Notes: