Skip to content

Commit 83e05ed

Browse files
authored
Merge pull request #224 from hemanth/jethrolarson-patch-1
Eliminate usage of ≍
2 parents 3a654a4 + 60b1b6f commit 83e05ed

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

readme.md

+19-9
Original file line numberDiff line numberDiff line change
@@ -455,22 +455,32 @@ Constant(1).chain(n => Constant(n + 1)) // => Constant(1)
455455
An object that implements a `map` function that takes a function which is run on the contents of that object. A functor must adhere to two rules:
456456

457457
__Preserves identity__
458-
```
459-
object.map(x => x) ≍ object
460-
```
458+
459+
```js
460+
object.map(x => x)
461+
```
462+
463+
is equivalent to just `object`.
464+
461465

462466
__Composable__
463467

468+
```js
469+
object.map(x => g(f(x)))
464470
```
465-
object.map(compose(f, g)) ≍ object.map(g).map(f)
471+
472+
is equivalent to
473+
474+
```js
475+
object.map(f).map(g)
466476
```
467477

468-
(`f`, `g` are arbitrary functions)
478+
(`f`, `g` are arbitrary composable functions)
469479

470-
A common functor in JavaScript is `Array` since it abides to the two functor rules:
480+
The reference implementation of [Option](#option) is a functor as it satisfies the rules:
471481

472482
```js
473-
;[1, 2, 3].map(x => x) // = [1, 2, 3]
483+
some(1).map(x => x) // = some(1)
474484
```
475485

476486
and
@@ -479,8 +489,8 @@ and
479489
const f = x => x + 1
480490
const g = x => x * 2
481491

482-
;[1, 2, 3].map(x => f(g(x))) // = [3, 5, 7]
483-
;[1, 2, 3].map(g).map(f) // = [3, 5, 7]
492+
some(1).map(x => g(f(x))) // = some(3)
493+
some(1).map(f).map(g) // = some(3)
484494
```
485495

486496
## Pointed Functor

0 commit comments

Comments
 (0)