What is an Algebraic Data Type (ADT)?

I heard people talk a lot about algebraic data types (not to be confused with "abstract data types") in functional programming. All I know is that ADT refers to some kind of composite (often recursive) data types, such as trees or mathematical expressions.

In wikipedia, he only said that:

the type of algebraic data is a kind of composite type, i.e. type formed by combining other types. Two common classes of algebraic types are product types (i.e., tuples and records) and sum types, also called labeled or unrelated unions or variant types.

But a formal definition is not given.

So I'm wondering what is the definition of ADT? According to Wikipedia, product types and sum types are two examples of ADT, but are the product and the sum of the only valid operations for determining ADT? Are there other operations that are also allowed?

+4
source share

Source: https://habr.com/ru/post/1681042/


All Articles