Jörg Winter
03/17/2021, 8:35 PMraulraja
03/17/2021, 8:59 PMlist {
println("I get printed 3 times")
listOf(1, 2, 3).bind()
}
We do have a Multishot delimited scope implementations that is flagged as internal
in arrow-continuations
ready for when compiler plugins are supported both with the new IR and IR backends and there is a strategy for compiler plugins in the IDE. Hopefully sometime in between 1.5 and 1.7+. At that point Arrow meta can expose a compiler plugin that verifies that monad binding in non-deterministic monads is reinterpreted so that can instrument the block to split it an ensure the effects before suspension points are not played more than once.raulraja
03/17/2021, 9:01 PMYoussef Shoaib [MOD]
03/18/2021, 5:08 PMimpure
block that you can call inside any multi-shot comprehension like list so that this impure block is only called once? this block can possibly be an extension on a new ImpureScope
class that just has a boolean to tell the impure block whether to run or not. The ImpureScope
could then be passed in as another receiver. I know that this isn't an elegant solution per se but it can allow people meanwhile to use comprehensions for these types and also for people who don't want to use compiler pluginsraulraja
03/18/2021, 5:57 PMraulraja
03/18/2021, 5:58 PMraulraja
03/18/2021, 6:00 PM