A PR was raised to make Arrow Fx Coroutines depend...
# arrow
s
A PR was raised to make Arrow Fx Coroutines depend on KotlinX Coroutines to easy integration and usage since almost everyone has KotlinX Coroutines on the classpath anyway. More details in the PR Reviews and feedback welcome: https://github.com/arrow-kt/arrow-fx/pull/317
🎉 4
👍 12
K 3
s
Stream
is also deprecated? what is the reasoning behind that?
s
Hey Stojan, by making KotlinX Coroutines the base dependency
Flow
is already included in the dependency. So
Stream
becomes a duplicated data-type. Our reasoning was that if we included the same operators to
Flow
as we have for
Stream
or were planning to build for
Stream
there is no strong reason anymore to build and maintain
Stream
. It's a very complex data type to develop and maintain and thus also very time-consuming/expensive. & getting contributions to Arrow Fx is hard. Some APIs we plan to add to
Flow
, tickets will be created soon.
parZipN
,
parEffectMa
,
parEffectMapUnordered
,
parMapN
,
merge
,
concurrently
,
interruption
etc
👍 1
We're not going to abandon the APIs we like, we just want to provide them in a way that makes more sense for everyone. Building and maintaining duplicated data-types doesn't make sense IMO unless there is a strong reason to do so.
s
will it be possible to implement the resource safety operators (bracket etc...) on top of
Flow
?
s
Yes, it'll work slightly different but you can use
Resource
and
bracket
directly in
flow
or
channelFlow
.
channelFlow
if you want to
emit
from
use
from a different context such as
withContext(<http://Dispatchers.IO|Dispatchers.IO>)
.
👍 1
In
Stream
(FS2) the resource is scoped to the consumer lifecycle, and implicitly closed upon some of the intermediately used operators. In
Flow
the resource is scoped to itself, when it exit from
use
, or when the
Flow
is cancelled or errors.
So that covers the same-use cases
s
awesome, thanks for your answers Simon and have a great day 🙂
s
You're very welcome @stojan! Have a great day and weekend!