https://kotlinlang.org logo
#functional
Title
# functional
g

gildor

02/21/2018, 10:34 AM
I like this pattern a lot, I even include own implementation of Result class (with value, HttpError and Exception cases) to my kotlin-coroutines-retrofit adapter, because it’s much more pleasant and safe to use something like this with coroutines (and not only with coroutines, but with any IO code)
c

chi

02/22/2018, 7:47 AM
Can you share an example of this
g

gildor

02/22/2018, 7:47 AM
Of what? How to work with Try? Or how does it work on kotlin-coroutines-retrofit?
c

chi

02/22/2018, 7:48 AM
Your "own implementation of Result class (with value, HttpError and Exception cases)"
yeah, with Try
c

chi

02/22/2018, 7:49 AM
Awesome. Thanks!
g

gildor

02/22/2018, 7:49 AM
Just common Sealed class, but used to represent success or error, similar to Try
1
c

chi

02/22/2018, 7:52 AM
Nice. Would take a look. Thanks
2 Views