In case someone can help review :pray: so we can p...
# arrow-contributors
r
In case someone can help review 🙏 so we can push these fixes https://github.com/arrow-kt/arrow-core/pull/259
There is an internal multishot impl but it’s very unsafe since it has to run the block n times so prior effects would run too. We are saving it to offer it with a compiler plugin where in those cases where a nondet case like List, Stream etc need to multishot binding always happens first and in order.
It’s not exposed in Effect for this reason
j
@raulraja I have a very hacky multishot version that uses the stacklabel trick and can interleave suspend. I use it in arrow-check's rewrite that I am doing to get rid of IO + mtl. Either way it cannot ever be mpp so it might be bad^^ So @Scott Christopher I could provide an implementation that can do multishot if you don't need mpp Yeah no I don't think this is as easy, for me this works because
Gen<R, A>
wraps a suspend function, and I do believe suspend is needed in the datatype itself 😕
r
@Jannis can it be mpp if we do expect / actual? or no way to do the reflection trick in native I guess
j
Well it needs reflection so^^ Its our old hack + interleaved suspend support, which is enough for me in arrow-check atm, but likely not enough in general
its also experimental, I have no clue of the weird things that could be done to break it^^ Especially around multithreading inside bindings.
The implementation is here if you are interested: https://github.com/arrow-kt/arrow-check/blob/b444fa88f8c38575c008fa17225e18dc975127e1/arrow-check/src/main/kotlin/arrow/check/property/Impl.kt#L28 Its specialized to Generators/Property tests tho. I am also not 100% sure how it'll work with non-suspend datatypes.
s
Thanks. Am I correct in understanding that
Effect<(R) -> A>
is also not possible, due to the need for providing
crossinline f: suspend Eff.() -> A
to
Effect.suspended
/
Effect.restricted
?