Product type
In programming languages and type theory, a product of types is another, compounded, type in a structure.[src] The "operands" of the product are types, and the structure of a product type is determined by the fixed order of the operands in the product.[src] An instance of a product type retains the fixed order, but otherwise may contain all possible instances of its primitive data types.[src] The expression of an instance of a product type will be a tuple, and is called a "tuple type" of expression.[src] A product of types is a direct product of two or more types.[src] If there are only two component types, it can be called a "pair type".[src] For example, if two component types A and B are the set of all possible values of that type, the product type written A \times B contains elements that are pairs (a, b) , where a and b are instances of A and B respectively.[src] The pair type is a special case of the dependent pair type, where the type B may depend on the instance picked from A .[src] In many languages, product types take the form of a record type, for which the components of a tuple can be accessed by label.[src] In languages that have algebraic data types, as in most functional programming languages, algebraic data types with one constructor are isomorphic to a product type.[src] In the Curry–Howard correspondence, product types are associated with logical conjunction ( ) in logic.…[src]
In programming languages and type theory, a product of types is another, compounded, type in a structure.[src] The "operands" of the product are types, and the structure of a product type is determined by the fixed order of the operands in the product.[src] An instance of a product type retains the fixed order, but otherwise may contain all possible instances of its primitive data types.[src] The expression of an instance of a product type will be a tuple, and is called a "tuple type" of expression.[src] A product of types is a direct product of two or more types.[src] If there are only two component types, it can be called a "pair type".[src] For example, if two component types A and B are the set of all possible values of that type, the product type written A \times B contains elements that are pairs (a, b) , where a and b are instances of A and B respectively.[src] The pair type is a special case of the dependent pair type, where the type B may depend on the instance picked from A .[src] In many languages, product types take the form of a record type, for which the components of a tuple can be accessed by label.[src] In languages that have algebraic data types, as in most functional programming languages, algebraic data types with one constructor are isomorphic to a product type.[src] In the Curry–Howard correspondence, product types are associated with logical conjunction ( ) in logic.[src] The notion directly extends to the product of an arbitrary finite number of types (an n -ary product type), and in this case, it characterizes the expressions that behave as tuples of expressions of the corresponding types.[src] A degenerate form of product type is the unit type: it is the product of no types.[src] In call-by-value programming languages, a product type can be interpreted as a set of pairs whose first component is a value in the first type and whose second component is a value in the second type.[src] In short, it is a cartesian product and it corresponds to a product in the category of types.[src] Most functional programming languages have a primitive notion of product type.[src] For instance, the product T_1 \times T_2 \times ...[src] \times T_n is written T 1 * T 2 * ...[src] * T n in ML and (T 1 , T 2 , ..., T n ) in Haskell.[src] In both these languages, tuples are written (v 1 , v 2 , ..., v n ) and the components of a tuple are extracted by pattern-matching.[src] Additionally, many functional programming languages provide more general algebraic data types, which extend both product and sum types.[src] Product types are the dual of sum types.[src] ==See also== Cartesian product Product (category theory) Quotient type Record (computer science) Struct (C programming language) Sum type ==References== Homotopy Type Theory: Univalent Foundations of Mathematics, The Univalent Foundations Program, Institute for Advanced Study.[src] See section 1.5.[src]
35 sentences · 35 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Product type." encyclopegia.org, 2026, https://encyclopegia.org/wiki/product-type. Accessed 02 December 2026.
Chicago
"Product type." encyclopegia.org. Accessed December 2, 2026. https://encyclopegia.org/wiki/product-type.
APA
encyclopegia.org. (2026). Product type. Retrieved December 2, 2026, from https://encyclopegia.org/wiki/product-type
Accessed December 2, 2026 · CC BY-SA 4.0 · citation page · JSON