mirror of
https://github.com/rjNemo/functional-programming-jargon
synced 2026-06-11 13:06:42 +00:00
Using equivalent operator for functor laws
...as opposed to threequals
This commit is contained in:
parent
86d9603981
commit
eceef7553d
1 changed files with 6 additions and 7 deletions
13
readme.md
13
readme.md
|
|
@ -313,16 +313,15 @@ john.age + five === ({name: 'John', age: 30}).age + (5)
|
||||||
|
|
||||||
An object that implements a `map` function which, while running over each value in the object to produce a new object, adheres to two rules:
|
An object that implements a `map` function which, while running over each value in the object to produce a new object, adheres to two rules:
|
||||||
|
|
||||||
```js
|
### Preserves identity
|
||||||
// preserves identity
|
```
|
||||||
object.map(x => x) === object
|
object.map(x => x) ≍ object
|
||||||
```
|
```
|
||||||
|
|
||||||
and
|
### Composable
|
||||||
|
|
||||||
```js
|
```
|
||||||
// composable
|
object.map(compose(f, g)) ≍ object.map(g).map(f)
|
||||||
object.map(x => f(g(x))) === object.map(g).map(f)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
(`f`, `g` be arbitrary functions)
|
(`f`, `g` be arbitrary functions)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue