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

Convert Promise-returning functions to Task-returning functions #97

robotlolita opened this Issue Mar 22, 2017 · 0 comments


None yet
1 participant

robotlolita commented Mar 22, 2017

Folktale should support converting from Promises to a more usable type. Because Promises are already eventual values, it makes sense to convert the functions that create them to functions creating Tasks instead of converting actual Promises to Tasks.

In essence, a function yielding a Promise, like:

f :: (Any...) => Promise Error Any

Would become a function yielding a Task, like:

promiseFunctionToTask(f) :: (Any...) => Task Error Any

promiseFunctionToTask is a really long name, though, so if you have better naming suggestions feel free to discuss them here :)

Where this goes?

In the data/conversions module, as promiseFunctionToTask.
In the data/task module, as fromPromiseFunction.

Refer to existing data/conversions modules, and the from* functions in data/maybe and data/either to see more or less how this is done.

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