Hi! I'm following the ArrowAndroidSamples example....
# arrow
s
Hi! I'm following the ArrowAndroidSamples example. There we have the following code:
Copy code
fun <F> Runtime<F>.loadNews(): Kind<F, List<NewsItem>> = fx.concurrent {
    val response = !effect(context.bgDispatcher) { fetchNews() }
    continueOn(context.mainDispatcher)

    if (response.isSuccessful) {
        response.news().toDomain()
    } else {
        !raiseError<List<NewsItem>>(response.code().toNetworkError())
    }
}.handleErrorWith { error -> raiseError(error.normalizeError()) }
I get a deprecation warning on fx.concurrent:
fx: MonadFx<F>' is deprecated. Overrides deprecated member in 'arrow.typeclasses.MonadError'. Fx will be moved to each datatype as a DSL constructor.
What is the correct way to handle this?
r
All kinded extensions are going to be deprecated in favor of suspend and those examples will be rewritten in terms of suspend, either and Either in 0.12.0. We will revisit kinds after Kotlin 1.5 if there is proper compiler plugins supports in IDEA. That functions would look like
suspend fun loadNews(): Either<YourCustomError, List<NewsItem>>
if it wasn’t kinded.