darkmoon_uk
09/24/2019, 3:03 AMFlow equivalent to Rx Merge ? http://reactivex.io/documentation/operators/merge.htmlzak.taccardi
09/24/2019, 3:04 AMdarkmoon_uk
09/24/2019, 3:04 AMdarkmoon_uk
09/24/2019, 3:05 AMdarkmoon_uk
09/24/2019, 3:05 AMdarkmoon_uk
09/24/2019, 3:05 AM@FlowPreview
fun <T> Flow<T>.mergeWith(other: Flow<T>): Flow<T> = flow {
    coroutineScope {
        launch {
            other.collect {
                emit(it)
            }
        }
        launch {
            collect {
                emit(it)
            }
        }
    }
}darkmoon_uk
09/24/2019, 3:05 AMdarkmoon_uk
09/24/2019, 3:11 AMdarkmoon_uk
09/24/2019, 3:11 AMmerge that runs more like your implementation - more direct.kevin.cianfarini
09/24/2019, 5:27 PMThe "gotcha" with concurrency limit is a strong motivator for a separate merge operator.Looks like that's the desired approach
bdawg.io
09/24/2019, 6:56 PMchannelFlow
fun <T> Flow<T>.mergeWith(other: Flow<T>) = channelFlow {
    launch { collect { send(it) } }
    launch { other.collect { send(it) } }
}bdawg.io
09/24/2019, 6:57 PMchannelFlow documentation provides a merge implementation as its example https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/channel-flow.html