use object init shorthand for prod types

This commit is contained in:
Talasan Nicholson 2017-11-08 01:10:39 -06:00 committed by GitHub
parent f6f0511100
commit ce3d8fca47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.