I'm working on a retrofit `CallAdapter` that would...
# arrow-contributors
s
I'm working on a retrofit
CallAdapter
that would work with:
Copy code
interface Service {

    @GET("/")
    suspend fun bodyEither(): Either<String, String>

    @GET("/")
    suspend fun bodyResponseE(): ResponseE<String, String>
}

// a more FP/Kotlin friendly version of retrofit2.Response
data class ResponseE<E, A>(
    val raw: okhttp3.Response,
    val code: Int,
    val message: String?,
    val headers: Headers,
    val body: Either<E, A>
) {

    val isSuccessful: Boolean = raw.isSuccessful
}
where the you can put the error body on the left. Would that be a good fit for
arrow-integrations
?
r
this would be great o have in the arrow retrofit integration as an addon or improvement of that is in there
👍 1
thanks @stojan arrow 💌
h
This remember me something right @stojan?🤔 🧌
✔️ 2
h
If there is some optimism about suspend + Either, what would you say if I will write somthing similar, but for IO?
Copy code
@GET("/")
fun getUser(): IO<E, T>
Where T will be the same as T in:
Copy code
fun getUser(): Mono<T>
And E will be ??? Maybe retrofit’s HttpException?
s
why not 🙂
maybe we can generalise on top of some typeclass
h
ok, I will explore that topic 😉
r
we can make Mono support E
for now slapping over it EitherT
but @simon.vergauwen has better ideas for long term solutions