simon.vergauwen
10/14/2019, 11:57 AMarrow-android we’d love to help people get started with any help they need 🙂dcampogiani
10/14/2019, 12:05 PMsimon.vergauwen
10/14/2019, 12:06 PMIO and the Android’s Lifecycle I think.
Which we should be able to easily refactor to F later on.thanh
10/14/2019, 12:11 PMsimon.vergauwen
10/14/2019, 12:11 PMObservable or Flowable than I wouldn’t recommend it.simon.vergauwen
10/14/2019, 12:12 PMIO but RxJava’s types are already “functional types”. You can also use them with Arrow Fx and with the principled APIs of Arrow.simon.vergauwen
10/14/2019, 12:13 PMautodipose since I only have a single stream in onResume (99% of the time).simon.vergauwen
10/14/2019, 12:14 PMflatMapIO is currently missing from the ObservableK and FlowableK API however.thanh
10/14/2019, 12:16 PMsimon.vergauwen
10/14/2019, 12:17 PMIO and suspend in the non-android layers so I could have MPP support by the end of the year.thanh
10/14/2019, 12:18 PMsimon.vergauwen
10/14/2019, 12:20 PMthanh
10/14/2019, 12:20 PMsimon.vergauwen
10/14/2019, 12:21 PMarrow-fx-rx integration which opens up safe combinators for Rx such as bracketCase etcsimon.vergauwen
10/14/2019, 12:21 PMIO but for Rxsimon.vergauwen
10/14/2019, 12:22 PMI want to provide more safe and general solution with Arrow.If you want to replace Rx with IO you can rely on recursion with
IO but I’d recommend sticking with Rx until arrow-streams becomes available.simon.vergauwen
10/14/2019, 12:23 PMarrow-fx-rx should give you similar guarantees, and since it’s Android specific you’re already tied to the JVM anyway.dcampogiani
10/14/2019, 12:28 PMdcampogiani
10/14/2019, 12:28 PMsimon.vergauwen
10/14/2019, 12:30 PMdcampogiani
10/14/2019, 12:31 PMcarbaj0
10/14/2019, 12:41 PMsimon.vergauwen
10/14/2019, 1:42 PMfun <A> IOOf<A>.unsafeRunScoped(owner: LifecycleOwner, cancelAt: Lifecycle.Event = Lifecycle.Event.ON_STOP, f: (Either<Throwable, A>) -> Unit): Unit =
if (owner.lifecycle.currentState == Lifecycle.State.DESTROYED) Unit
else {
val disposable = fix().unsafeRunAsyncCancellable(cb = f)
owner.lifecycle.addObserver(object : LifecycleEventObserver {
override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
if (event == cancelAt) disposable.invoke()
}
})
}