Skip to content
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

Provide way to use tuples instead of list for "all" #36

Closed
kgoggin opened this issue Dec 5, 2018 · 9 comments
Closed

Provide way to use tuples instead of list for "all" #36

kgoggin opened this issue Dec 5, 2018 · 9 comments

Comments

@kgoggin
Copy link

kgoggin commented Dec 5, 2018

Hey there! Thanks so much for this library - I'm really enjoying using it in my project over the standard Js.Promise.t!

One API that Js.Promise provides that I do miss, however, is the ability to resolve a set of promises in parallel that don't all have the same type via a tuple.

From the JS side, I think the implementation would be pretty easy:

let all2 = (p1, p2) =>
    [|p1, p2|]
    |> jsAll
    |> map (results => {
      let mappedResults = results |> Array.map(unwrap);
      (mappedResults[0], mappedResults[1])
    });

But, I'm not as familiar with writing native Reason code, so I've got no idea if it'd be that straightforward there... and if it isn't, I presume the idea would be to keep the API the same for native and JS, right?

@aantron
Copy link
Owner

aantron commented Dec 5, 2018

Thanks for the suggestion :)

This should be easy to implement on native as well. I can do it later today/tomorrow :) I'd probably create all2-all6, relying on the precedent that Js.Promise goes up to all6.

@kgoggin
Copy link
Author

kgoggin commented Dec 5, 2018

Awesome! Yeah, I think replicating the Js.Promise makes great sense. Can't wait to try it out!

aantron added a commit that referenced this issue Dec 19, 2018
@aantron
Copy link
Owner

aantron commented Dec 19, 2018

Okay, all2-all6 are merged in, for both JS and native:

https://github.com/aantron/repromise/blob/a166c2bc37a04fdc1a142786d8e6a580e5203608/src/js/repromise.rei#L21-L40

Sorry about the delay, I needed to take a break from public work for a while :/

@kgoggin
Copy link
Author

kgoggin commented Dec 19, 2018

@aantron that's awesome, thanks so much! And no worries about the delay - hope all is well. Thanks again for this great lib!

@aantron
Copy link
Owner

aantron commented Dec 19, 2018

Great :)

Are you depending on Repromise from GitHub? Would you prefer a speedy release of these functions to NPM?

@kgoggin
Copy link
Author

kgoggin commented Dec 19, 2018

Yeah, I'm using the npm package, not GH, but I'm also not stuck waiting on this. So, no rush to ship a new release if you want to wait a bit.

@aantron
Copy link
Owner

aantron commented Dec 19, 2018

Ok, thanks. I'll see if I get around to doing anything else soon-ish, then do a release.

@kgoggin
Copy link
Author

kgoggin commented May 7, 2019

Hi! I just bumped up another use for this - would you mind cutting a release with this code when you have a chance?

@aantron
Copy link
Owner

aantron commented Jul 12, 2019

This is now out as 0.6.1. The changelog is here. Sorry for the delay, I was on hiatus.

@aantron aantron mentioned this issue Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants