-
Notifications
You must be signed in to change notification settings - Fork 694
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
Explicit effect types #3119
base: main
Are you sure you want to change the base?
Explicit effect types #3119
Conversation
To fix |
Tests are now fixed. I've added sttp ZIO backends to test ZIO implementations. We can add some kind of a table in docs to express which backend can be used with the monad of choice:
|
After this change, |
I think this is a big change, We only can release this in a major version bump (hopefully 9). So, I guess We should rip the band-aid by removing |
@lenguyenthanh yes backwards compatibility went sideways with this PR. Still, I think it's a change long needed. In the last commit custom executors were replaced with a single generic Executor, that kinda does the same. Still |
48eefab
to
4b4a83d
Compare
I think We can achieve the same functionality with |
Yeah, I can think this can be achieved with |
Indeed this will not be a change that can be merged without a major version bump. I can make an RC release or something like that if that is handy for testing. |
An RC is great, thanks! I guess We can have this and #3118 and maybe another pr to removing |
I think we will also need to change the docs in that case, and can add removal of Sttp Future backend as a default dependency for the Sttp client. I've been also thinking how to get rid of |
yes, We definitely need docs and a proper change log for this.
I think the decision We need to make here is do We want to pull cats dependencies to core module for I prefer to user cats.Functor directly as I believe it's quite ubiquitous in Scala world at this point and it keeps binary compatibility for last several years. |
@lenguyenthanh the problem with |
IMHO, I think We can and We should remove all But this is ultimately @Philippus's decision. |
elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches/SearchIterator.scala
Outdated
Show resolved
Hide resolved
this looks great, thanks @igor-vovk for your work! I think We should create a branch (something like v8.0.0) to merge all @igor-vovk's prs and then publish a RC, what do you think @Philippus ? |
b1eb296
to
3a65468
Compare
@Philippus We would very appreciate, if you can comment on how to proceed this PR (and other related pre as well) 🙏 I think this is a great improvement as it's simplify the code base a lot, remove many concepts and that leads to less allocations, better ergonomic code. It is especially helpful for cats users as We can use async IO from the top to bottom without any intermediate layers. |
51cb2e2
to
a2f27f4
Compare
Hi @Philippus sorry to ping you again and again. But I really love to try this other PRs that @igor-vovk's spend time to work on. Could you have some word about these prs? It's fine if you don't think this is the way forward but please tell us so. |
I will try to look into it soon, have to find some time. |
thanks @Philippus, much appreciated 🙏 |
This addresses #2379.
Overall I deleted more code than I've added which is a good sign.
AkkaHttpClient
andPekkoHttpClient
were wrapping a lot ofFuture
's under the hood – this is now removed and looks much cleaner.JavaClient
now uses ScalaPromise/Future
mechanism that doesn't require any 3rd-party libraries and that was created to replace callback mechanisms, I think it is better this waySttpRequestHttpClient
was a wrapper aroundFuture
monad's Sttp implementation – now allows any monads that are supported bySttp
, feels like a proper way to use it.Testkit
now explicitly define thatFuture
effect is used, which was used under the hood before as well, just not explicitly shown.Executor
's became empty since all handling is now performed on theClient
's level. I left them just to show that they are now obsolete, will be happy to remove them as well.Executor
s, I tend to think thateffect-zio
,effect-zio-1
,effect-cats
,effect-cats-2
,effect-monix
,effect-scalaz
modules can be also removed as a future improvement (not sure about that, this may requirecats
dependency to reuseFunctor
that is now defined manually inelastic4s-core
and that those modules implement).I would add that the way the callback mechanism was defined and used looked like a big hack for me, that was maybe historically implemented because library started with only
JavaClient
? I didn't check this assumption, but overall, everything thatExecutor
's andClient
's were doing, is mapping fromK[_]
monad implemented by 3rd-party clients, through(Either[Throwable, A]) => Unit
callback, toF[_]
monad used on the top-level. So there was this clunky 3-step transformation that hidden a lot of stuff.