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:
bsanches 2016-06-08 09:54:15 -07:00
parent c745ecb7a0
commit 6ce00b53a5

View file

@ -441,8 +441,8 @@ compose(foo, identity) ≍ compose(identity, foo) ≍ foo
```js
let CoIdentity = v => ({
val: v,
extract: this.v,
extend: f => CoIdentity(f(this))
extract: function () { return this.val },
extend: function (f) { return CoIdentity(f(this)) }
})
```