PhBastiani
08/27/2019, 12:09 PMfx
syntax for comprehensions... If i understand, the new impl uses coroutines under the cover !
I replaced the calls of bindind()
by fx.monad
Now, I have something like that :
fx.monad {
val vMaybe:Option<T> = ...
vMaybe.map { mymonadfunction(...).bind() }
...
Here, the call of bind()
gives me an error 'Suspension functions can be called only within coroutine body'... What is the new syntax for this kind of binding ? Thx in advance....simon.vergauwen
08/27/2019, 1:16 PMbind
within the lambda of map
there.simon.vergauwen
08/27/2019, 1:17 PMmap
is inlined the bind
suspend function is executed in a non-suspending lambda.PhBastiani
08/27/2019, 2:09 PMfx.monad {
val vMaybe:Option<T> = ...
!vMaybe.map { xxx(...) }.getOrElse { Free.just() }
}.fix()
pakoito
08/27/2019, 3:02 PM