arrow-kt / arrow-fx

Λrrow Fx is part of Λrrow, a functional companion to Kotlin's Standard Library
http://arrow-kt.io
Other
64 stars 15 forks source link

Deprecate Reactor in favor of KotlinX Coroutines Reactor #383

Closed nomisRev closed 3 years ago

nomisRev commented 3 years ago

Since Arrow Fx Coroutines is going to be the new way forward over IO or polymorphic effect typeclasses the Arrow Fx Reactor module is deprecated in favor of using Arrow Fx Coroutines + KotlinX Coroutines Reactor.

import kotlinx.coroutines.reactor.mono
import kotlinx.coroutines.reactor.asCoroutineDispatcher
import reactor.core.scheduler.Scheduler

val mono: Mono<Pair<String, String>> = mono {
  parMapN(Schedulers.computation().asCoroutineDispatcher(),
    { Thread.currentThread().name },
    { Thread.currentThread().name },
    ::Pair
  )
}