https://kotlinlang.org logo
#arrow-contributors
Title
# arrow-contributors
s

stojan

04/25/2020, 1:06 PM
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

raulraja

04/25/2020, 2:48 PM
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

HarryPulvirenti

04/25/2020, 5:31 PM
This remember me something right @stojan?🤔 🧌
✔️ 2
h

Hiosdra

04/29/2020, 9:43 AM
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

stojan

04/29/2020, 10:15 AM
why not 🙂
maybe we can generalise on top of some typeclass
h

Hiosdra

04/29/2020, 10:32 AM
ok, I will explore that topic 😉
r

raulraja

04/29/2020, 12:32 PM
we can make Mono support E
for now slapping over it EitherT
but @simon.vergauwen has better ideas for long term solutions
10 Views