-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add promise <-> monad bridge functions #35
Comments
resolveP = bind(Promise.resolve, Promise); |
Something like https://github.com/kirillrogovoy/promised-pipe might also be useful. |
@rockymadden isn't pipeP what you're looking for ? |
If all functions are return promises, yes. The promised-pipe brings the ability to intermix, at any point, sync and async functions. |
pipeP does the same. The only requirement is that first function in the pipe must be promise generator (returns promise). const { add, subtract } = require('ramda');
const resolveP = Promise.resolve.bind(Promise);
const asyncAdd = val => resolveP(val).then(add(1));
pipeP(
resolveP,
add(1),
subtract(1),
asyncAdd,
add(2),
subtract(1)
)(1); |
Nice, hmm yeah ignore me then. Thanks! BTW, I see some of what you are laying out here mentioned through out various Ramda issues on the topic of Promises (e.g. ramda/ramda#1869 (comment)). Lovely idea. |
NP |
Thoughts on your EDIT: Ignore, I see it now as the first function in the list above. |
Yep, the plan is to implement it. Checkout out the first comment of this issue. It is the first function to be implemented for this issue ;] |
You can provide a pull request for it if you wish and become a contributor. ramda-adjunct ecosystem is ready to receive PR's and I always welcome any help. What do you think ? |
Yep, love it. I've had a subset of this library internally for a while. Was reading through the Ramda wiki and saw |
Yep, I guess everybody is doing it. This library has a potential saving a lot of development time to a lot of people. Check this article to find out more. Great, check out the CONTRIBUTING.md and you can start right away. |
Further inspirations: https://github.com/krainboltgreene/unction.js?files=1 |
@char0n You OK if I bump this to 2.7.0? |
Bump it up or remove the milestone entirely. Have no usecases for the rest of them right now. |
@char0n When you get a chance maybe move remaining to separate issues. |
Yeah me or anybody else can do that. Note for me and others: when doing it reference this issue in the child issues just for reference and then close this one. |
since #676, additional candidates are :
IMO, we need to talk about parallel and series behavior, isn't ? |
Yes I think we should and I'm very interested in this discussion. But I'm still thinking about this in a context of already implemented reduceP. Does it make sense to have reduceP work in a parallel mode ? Can you provide example of |
Created separate issue for raceP |
created separate issue for catchP |
created separate issue for thenCatchP |
Not going to implement tapP for now. |
resolveP,allP, tapP,thenP, catchP, thenCatchP,rejectP, raceP,reduceP,isThenable,isPromise, tryPThe text was updated successfully, but these errors were encountered: