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

Hiosdra

06/01/2020, 11:30 AM
Hi, I’m about: https://github.com/arrow-kt/arrow-integrations/pull/28 I found problem to solve: In case of returning
IO<Nothing, A>
Kotlin compiler(??? or Jvm?) erases all information about generics in this class. If method returns
IO<E, A>
where E is any type but
Nothing
, generic info is kept. Retrofit integration needs generic info, because Retrofit is a runtime library. I’ve also tested merged into master suspend + Either integration and it fails in the same place. Do anyone has some more knowledge about bytecode representation of
Nothing
and why compiler/Jvm do that only for
Nothing
type? Below are photos with brakepoint on
adapterType = method.getGenericReturnType()
(HttpServiceMethod.java:62)
r

raulraja

06/01/2020, 3:01 PM
I believe the Nothing case would need to be handled manually for the Either encoder
s

stojan

06/01/2020, 5:02 PM
you could also use
suspend fun getUser(): User
directly if you don't expect HTTP errors
4 Views