mirror of
https://github.com/rjNemo/functional-programming-jargon
synced 2026-06-06 02:26:43 +00:00
monads
This commit is contained in:
parent
6f9368e628
commit
19570db1d1
1 changed files with 10 additions and 0 deletions
10
readme.md
10
readme.md
|
|
@ -170,6 +170,16 @@ randIter.next(); // Each exectuion gives a random value, expression is evluated
|
|||
|
||||
## Monad
|
||||
|
||||
> A Monad is a pattern to describe computations as a series of steps.
|
||||
|
||||
A monad is a "unit" function that wraps a value and produces the same value by way of a "bind" function and are sometimes referred to as "programmable semicolons" due to the fact that they represent chainable computations.
|
||||
|
||||
The simplest monad is the Identity monad. It simply wraps a value.
|
||||
|
||||
```js
|
||||
let Identity = v => ({ bind: transform => transform(v) })
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Comonad
|
||||
|
|
|
|||
Loading…
Reference in a new issue