Hey y'all! I'm just starting to learn some reactiv...
# arrow
t
Hey y'all! I'm just starting to learn some reactive patterns and was wondering what people see the relationship between something like arrow or arrow fx and flux/mono/etc might be (and suspend)? Would you pick one over the other, or are they complementary or isomorphic?
r
You can implement any use case in either one but the suspend system thanks to continuations and the CPS transformation the compiler performs on suspend functions can cover all use cases of Single, Mono etc in a more performant way. It can provide direct syntax without the wrappers indirection. The exception is things like Flow and even then the builders and wrappers can emit and collect in direct style when in the scope of a FlowCollector. I would choose suspend and any system that relieves me from having to map and flatMap in order to call the operations I care about.
I think system with continuations and non-blocking IO are a step forward in simplicity to express the same things we used to express with wrapped types. Easier to learn and higher runtime performance due to lesser allocations and code that is optimized for the stack.
d
If I understand the question correctly this was more about arrow vs reactive than different reactive models vs each other? @tavish pegram
r
I think Arrow covers all the reactive use cases completely eliminating
Mono, Single, IO
and other single value wrappers by using
suspend
. As for the streaming part it piggy backs on
Flow
. For the sync scenarios it provides additional useful methods and types not present in KotlinX Coroutines like parZip, CircuitBreaker, Resource, Schedule, etc. @tavish pegram @Daniel Skogquist Åborg you can intermix code in them and I believe they are isomorphic but if I had a greenfield project I’d choose Arrow or plain Kotlin with kotlinX Coroutines or a reactive system that supported
suspend
functions.
👌 1
d
Definitely something to look into. 👍