mirror of
https://github.com/rjNemo/functional-programming-jargon
synced 2026-06-11 21:16:43 +00:00
Fix Comonad example
- Current example doesn't run - `extract` is supposed to be a function - `this.v` is not a thing - Unfortunately, I'm not sure if it's possible to do this with arrow functions, as they'll bind the current `this` scope, which will be `CoIdentity`'s current scope instead of the actual returned object..
This commit is contained in:
parent
c745ecb7a0
commit
6ce00b53a5
1 changed files with 2 additions and 2 deletions
|
|
@ -441,8 +441,8 @@ compose(foo, identity) ≍ compose(identity, foo) ≍ foo
|
||||||
```js
|
```js
|
||||||
let CoIdentity = v => ({
|
let CoIdentity = v => ({
|
||||||
val: v,
|
val: v,
|
||||||
extract: this.v,
|
extract: function () { return this.val },
|
||||||
extend: f => CoIdentity(f(this))
|
extend: function (f) { return CoIdentity(f(this)) }
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue