Add an apply function to the Async monad
This commit is contained in:
parent
06f0b21e85
commit
5048fb134c
1 changed files with 7 additions and 0 deletions
7
async.js
7
async.js
|
@ -1,5 +1,6 @@
|
|||
function Async() {
|
||||
return {
|
||||
apply: apply,
|
||||
bind: bind,
|
||||
parallel: parallel,
|
||||
run: run,
|
||||
|
@ -8,6 +9,12 @@ function Async() {
|
|||
wrap: wrap
|
||||
};
|
||||
|
||||
function apply(f, x) {
|
||||
return function(g) {
|
||||
g(f(x));
|
||||
};
|
||||
}
|
||||
|
||||
function bind(m, f) {
|
||||
return function(g) {
|
||||
m(function(x) {
|
||||
|
|
Loading…
Reference in a new issue