Closed LordRaydenMK closed 4 years ago
hey @leandroBorgesFerreira
I extracted a function in ArrowCallAdapterFactory
for the duplicated code.
For the ArrowEitherCallAdapter
and ArrowEitherECallAdapter
the code looks similar, but the types are all different e.g. Call<Either<E, R>>
VS Call<ResponseE<E, R>>
the Callback
type is also different, so I would have to parametrize a lot of things. That would make the code harder to read IMO.
I'm a bit out of the scene, what is the motivation of the PR? I think Async already has ways to handle exceptions and Either is normally used for synchronous calls.
this works with suspend + Either
meaning it isomorphic to IO<E, A>
and can be used for async calls.
Supports declaring your Retrofit interface like:
note:
ResponseE
is the equivalent ofretrofit.Response
but using Either for the body (left in case of HTTP error, right in case of success).Problems: There is a null check for the body, meaning it errors on 204 (No Content) because the body is null in that case.