-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
make EitherAsync interface more versatile #192
Conversation
Wow, thanks for the contribution! I think I really like the changes to |
Yeah look forward to your feedback. For I'm open to however you think is best to implement this, just as long as it's easy to work with async mapping functions. |
One of the main criticisms in the FP community of promises is how they break certain monadic laws. One might deliberately want something like Making |
Interesting, how so? Promises themselves are monads, right? But maybe there's some weird corner cases I'm not thinking of.
I see what you mean, I see
Hmm I see what you mean here. If you do something like: liftEither(Right(10))
.map(n => liftEither(Right(n + 5))); You get a |
They are not. Check out this controversial thread from years ago |
66511d5
to
ce80c93
Compare
Are there any changes you want to make? If you have an idea of the interface you want but just don't have time, I'd be happy to bang it out. |
Hey, I copied some of the changes you made, unfortunately the discrepancies are too big for me to merge this PR, I hope that's okay with you. I want to thank you again for your contribution, you can see the new implementation of EitherAsync in
|
Awesome, thanks, is there a new deployed beta version? We've been using an internal dev deploy to work off of.
That's fair enough. What do you think would be best practice for mapping over some async operations from an EitherAsync? |
In my project I've been integrated Purify mostly to get the benefits of Either and Maybe. When I hit some async parts of our code I saw some potential ways to make
EitherAsync
s easier to work with.Specifically:
EitherAsync
extendPromise<Either>
map
andmapLeft
now work with async map functionschain
andchainLeft
now work with chain functions that returnEither
orPromise<Either>
Quick example. Assume you have the following operations you might want to do on your data:
Monadic chaining with the current interface would look something like:
With the new interface, you can do: