New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement to integrate Tasks with JS syntax #111

robotlolita opened this Issue Apr 2, 2017 · 0 comments


None yet
1 participant

robotlolita commented Apr 2, 2017

Folktale should add a function that allows using generators to integrate Task with JavaScript's syntax, like async/await does for promises. In essence, this would allow one to write:

const readFile = task((resolver) => ...);

const someTask = *() {
  const fileA = yield readFile('a.txt');
  const others = yield Task.parallel([readFile('b.txt'), readFile('c.txt')])
                           .map(xs => xs.join(''));
  return fileA + others;
  onCancelled: () => ...,
  onRejected: (reason) => ...,
  onResolved: (data) => console.log(data)


Since people can convert a Task's execution to a promise, they're already able to use async/await, but that requires buying into the disadvantages promises have. In particular, the fact that promises catch errors automatically, and recursively tries to assimilate any object with a .then method may make programs harder to reason about. would provide similar syntactical sugar as async/await does, without the semantic drawbacks of promises.

@robotlolita robotlolita added this to the Post 2.0 milestone Apr 2, 2017

framp added a commit to framp/folktale that referenced this issue Jun 21, 2017

(new base tests) Adds
`` accepts a Task-emitting Generator and returns a Task which
will execute all the tasks and pass back the appropriate values to the

Fixes origamitower#111

@framp framp referenced this issue Jun 21, 2017


Adds #128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment