mirror of
https://github.com/rjNemo/functional-programming-jargon
synced 2026-06-06 02:26:43 +00:00
use object init shorthand for prod types
This commit is contained in:
parent
f6f0511100
commit
ce3d8fca47
1 changed files with 1 additions and 1 deletions
|
|
@ -843,7 +843,7 @@ A **product** type combines types together in a way you're probably more familia
|
|||
|
||||
```js
|
||||
// point :: (Number, Number) -> {x: Number, y: Number}
|
||||
const point = (x, y) => ({x: x, y: y})
|
||||
const point = (x, y) => ({ x, y })
|
||||
```
|
||||
It's called a product because the total possible values of the data structure is the product of the different values. Many languages have a tuple type which is the simplest formulation of a product type.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue