From 5048fb134c37d4b03a66a6d38595f3d3f0a042e6 Mon Sep 17 00:00:00 2001 From: Tissevert Date: Sun, 13 Jan 2019 20:23:48 +0100 Subject: [PATCH] Add an apply function to the Async monad --- async.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/async.js b/async.js index 1205b00..6c9ef2c 100644 --- a/async.js +++ b/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) {