Pagoda 5b
11/18/2019, 9:43 AMsimon.vergauwen
11/18/2019, 9:43 AMPagoda 5b
11/18/2019, 9:43 AMPagoda 5b
11/18/2019, 9:51 AM//the first fx.monad composition is only to sequence multiple effectful ops
fun <F> MonadDefer<F>.doThis() = fx.monad {
val (manager) = ...some stuff
later {
manager.on<Event>().k() //<- switch to kotlin flowK
.filter (...)
.traverse(this@doThis) { ev ->
//call that creates a Kind<F, A>
}.map {
it.value() //<- unwraps the FlowK
.flatMap { result ->
createAction(result).asMono()
}.subscribe()
}
}.bind()
}
simon.vergauwen
11/18/2019, 9:52 AMFlow
within F
.Pagoda 5b
11/18/2019, 9:52 AMKind<F, _>
that now contains the new flowPagoda 5b
11/18/2019, 9:53 AMlater
that gets bind()
-ed, but I mightāve forgotten to do the same with the āwrappedā effect?simon.vergauwen
11/18/2019, 9:55 AMmanager
, right?simon.vergauwen
11/18/2019, 9:55 AMF
instead?simon.vergauwen
11/18/2019, 9:56 AMFlow
or Flux
? If there is an integration package for Flow
weād love to have it in Arrow.simon.vergauwen
11/18/2019, 9:56 AMPagoda 5b
11/18/2019, 9:57 AMFluxK
Pagoda 5b
11/18/2019, 9:57 AMPagoda 5b
11/18/2019, 9:57 AMPagoda 5b
11/18/2019, 9:58 AMsimon.vergauwen
11/18/2019, 9:58 AMPagoda 5b
11/18/2019, 9:58 AMPagoda 5b
11/18/2019, 9:59 AMsimon.vergauwen
11/18/2019, 9:59 AMPagoda 5b
11/18/2019, 9:59 AMsimon.vergauwen
11/18/2019, 9:59 AMPagoda 5b
11/18/2019, 10:00 AMPagoda 5b
11/18/2019, 10:01 AMPagoda 5b
11/18/2019, 10:01 AMsimon.vergauwen
11/18/2019, 10:11 AMEvents
from the manager, and executes an effect F
for every Event
. This doThis(): Kind<F, Unit>
finishes when all events are processed.simon.vergauwen
11/18/2019, 10:12 AMPagoda 5b
11/18/2019, 10:12 AMPagoda 5b
11/18/2019, 10:12 AMPagoda 5b
11/18/2019, 10:53 AM!
prepended to the manager.onEvent...
at line 27 does?Pagoda 5b
11/18/2019, 10:54 AMsimon.vergauwen
11/18/2019, 10:54 AMval (unit) = manager.onEvent().k()
or .bind()
at the endsimon.vergauwen
11/18/2019, 10:55 AMflatMap
on manager.onEvent().k()
returns Unit
but you still need to execute it within fx
with component1
, bind
or not
Pagoda 5b
11/18/2019, 10:55 AMeffect{...}
in examples and didnāt make the connection šsimon.vergauwen
11/18/2019, 10:55 AM