Added basic description of semigroup. Fixed comonad

This commit is contained in:
jethro larson 2016-02-20 23:03:05 -08:00
parent 6913df8f93
commit ed415a1003

View file

@ -321,9 +321,9 @@ Extract takes a value out of a container. Essentially it's the opposite of `of`.
CoIdentity(1).extract() // 1 CoIdentity(1).extract() // 1
``` ```
Extend runs a function on the comonad. The function should return the same type as the value in the Comonad. It's the opposite of `chain`. Extend runs a function on the comonad. The function should return the same type as the Comonad.
```js ```js
CoIdentity(1).extend(co => co.extract() + 1) // 2 CoIdentity(1).extend(co => co.extract() + 1) // CoIdentity(2)
``` ```
--- ---
@ -384,6 +384,12 @@ Array.prototype.equals = arr => {
## Semigroup ## Semigroup
An object that has a `concat` function that combines it with another object of the same type.
```js
[1].concat([2]) // [1, 2]
```
--- ---
## Foldable ## Foldable