Add an apply function to the Async monad

This commit is contained in:
Tissevert 2019-01-13 20:23:48 +01:00
parent 06f0b21e85
commit 5048fb134c
1 changed files with 7 additions and 0 deletions

View File

@ -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) {