raulraja
09/04/2019, 3:43 PMIO<Unit>
then at the very edge where you need to perform the action you can call unsafeRunAsync
or any other variation of that method to run the program.
What attempt
does is turn IO<A>
into IO<Either<Throwable, A>>
forcing the receiver of the last typed value to deal in composition with the fact that the operation may have failed with an exception which can be found in the Leftnoiano
09/04/2019, 4:02 PMwaitForCompletion
kinda thing?noiano
09/04/2019, 4:02 PMsimon.vergauwen
09/04/2019, 4:23 PMunsafeRunSync()
which blocks the callers thread or unsafeRunAsync { }
which allows the run IO
to fork executionsimon.vergauwen
09/04/2019, 4:23 PMunsafeRynAsyncCancellable { }
which returns a typealias Disposable = () -> Unit
which you can use to cancel the running IO
.simon.vergauwen
09/04/2019, 4:24 PMIO
cancelation gets checked on flatMap
boundaries.noiano
09/04/2019, 4:29 PMsimon.vergauwen
09/04/2019, 4:29 PMsimon.vergauwen
09/04/2019, 4:30 PMnoiano
09/04/2019, 4:31 PMnoiano
09/04/2019, 4:31 PMsimon.vergauwen
09/04/2019, 4:33 PMnoiano
09/04/2019, 4:36 PMnoiano
09/04/2019, 4:36 PM