3 ms·
The OCaml type 'a * 'b is the equivalent of the Haskell type (a, b). This type is known as the Cartesian product type, and it's written with a multiplication sy
by TheAsprngHacker 7y ago
The OCaml type 'a * 'b is the equivalent of the Haskell type (a, b). This type is known as the Cartesian product type, and it's written with a multiplication symbol in type theory (hence the asterisk in OCaml syntax).
The product type is the type of pairs. It's definition is
x : A
y : B
--------------
(x, y) : A * B
meaning that if x has type A and y has type B, then (x, y) has type A * B.
- Product type on Wikipedia: https://en.wikipedia.org/wiki/Product_type https://en.wikipedia.org/wiki/Product_type
- Product type on the nLab (which is a math-heavy resource): https://ncatlab.org/nlab/show/product+type https://ncatlab.org/nlab/show/product+type