Sergio Crespo Toubes
04/16/2019, 3:41 PMoverride fun getElements(): Either<Throwable, List<Element>> {
return elementsApi.getElements(authToken)
.async(IO.async())
.fix()
.unsafeRunSync()
.unwrapBody(Either.applicativeError())
.fix()
}
This is working for me, but is the good way for using arrow with retrofit? getElements return CallK object.raulraja
04/16/2019, 4:05 PMIOraulraja
04/16/2019, 4:05 PMunsafeRunAsync or equivalentSergio Crespo Toubes
04/16/2019, 4:06 PMIO?raulraja
04/16/2019, 4:07 PMelementsApi.getElements(authToken)
.async(IO.async())
.fix()
.attempt()raulraja
04/16/2019, 4:08 PMattemptraulraja
04/16/2019, 4:08 PMraulraja
04/16/2019, 4:08 PMsimon.vergauwen
04/16/2019, 4:09 PMfun getElements(): IO<List<Element>> has the same semantics as Either<Throwable, ..> and allows for similar error handling with errorHandleWith, attempt or similar combinators.Sergio Crespo Toubes
04/16/2019, 4:10 PM