in mobius-coroutines/src/main/java/com/spotify/mobius/coroutines/CoroutinesSubtypeEffectHandlerBuilder.kt [308:321]
fun createEffectsHandler(effectHandler: EffectHandler<G, E>): EffectsHandler<F, E>
/**
* Implementation of [ExecutionPolicy] where all effects of the same type wait for the previous one
* to finish executing before being executed.
* */
class RunSequentially<G : F, F : Any, E : Any> : ExecutionPolicy<G, F, E> {
override fun createEffectsHandler(effectHandler: EffectHandler<G, E>) =
EffectsHandler<F, E> { effectChannel, eventsChannel ->
for (effect in effectChannel) {
effectHandler.handleEffect(effect as G, eventsChannel)
}
}
}