mirror of
https://github.com/rjNemo/functional-programming-jargon
synced 2026-06-06 02:26:43 +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:
|
||||
|
||||
```js
|
||||
// preserves identity
|
||||
object.map(x => x) === object
|
||||
### Preserves identity
|
||||
```
|
||||
object.map(x => x) ≍ object
|
||||
```
|
||||
|
||||
and
|
||||
### Composable
|
||||
|
||||
```js
|
||||
// composable
|
||||
object.map(x => f(g(x))) === object.map(g).map(f)
|
||||
```
|
||||
object.map(compose(f, g)) ≍ object.map(g).map(f)
|
||||
```
|
||||
|
||||
(`f`, `g` be arbitrary functions)
|
||||
|
|
|
|||
Loading…
Reference in a new issue