Added to Favorites

In programming languages, the product of two types is the type that characterizes the expressions which behaves, with respect to the evaluation mechanism, as pairs whose first component is an expression of the first type and whose second component is an expression of the second type.

In the Curry-Howard correspondence, product types are associated with logical conjunction (AND) in logic.

The notion directly extends to the product of an arbitrary finite number of types (a n-ary product type), and in this case, it characterizes the expressions which behave as tuples of expressions of the corresponding types. A degenerated form of product type is the unit type.

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. In short, it is a cartesian product and it corresponds to a product in the category of types.

Most functional programming languages have a primitive notion of product type. For instance, the product of type_{1}, ..., type_{n} is written type_{1}` * `

...` * `

type_{n} in ML and `(`

type_{1}`,`

...`,`

type_{n}`)`

in Haskell. In both these languages, tuples are written `(`

v_{1}`,`

...`,`

v_{n}`)`

and the components of a tuple are extracted by pattern-matching.

In many languages, product types take the form of a record type for which the components of a tuple can be accessed by label. 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.

Wikipedia, the free encyclopedia © 2001-2006 Wikipedia contributors (Disclaimer)

This article is licensed under the GNU Free Documentation License.

Last updated on Saturday August 23, 2008 at 23:25:15 PDT (GMT -0700)

View this article at Wikipedia.org - Edit this article at Wikipedia.org - Donate to the Wikimedia Foundation

This article is licensed under the GNU Free Documentation License.

Last updated on Saturday August 23, 2008 at 23:25:15 PDT (GMT -0700)

View this article at Wikipedia.org - Edit this article at Wikipedia.org - Donate to the Wikimedia Foundation

Copyright © 2015 Dictionary.com, LLC. All rights reserved.