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

View file

@ -1,5 +1,6 @@
function Async() { function Async() {
return { return {
apply: apply,
bind: bind, bind: bind,
parallel: parallel, parallel: parallel,
run: run, run: run,
@ -8,6 +9,12 @@ function Async() {
wrap: wrap wrap: wrap
}; };
function apply(f, x) {
return function(g) {
g(f(x));
};
}
function bind(m, f) { function bind(m, f) {
return function(g) { return function(g) {
m(function(x) { m(function(x) {