https://kotlinlang.org logo
#arrow-contributors
Title
# arrow-contributors
r

raulraja

12/10/2020, 1:34 PM
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

Jannis

12/14/2020, 4:22 PM
@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

raulraja

12/14/2020, 4:23 PM
@Jannis can it be mpp if we do expect / actual? or no way to do the reflection trick in native I guess
j

Jannis

12/14/2020, 4:25 PM
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

Scott Christopher

12/15/2020, 12:16 AM
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
?
4 Views