arrow-effects-rx2-data / arrow.effects.rx2 / SingleK


@higherkind data class SingleK<A> : SingleKOf<A>, SingleKKindedJ<A>


<init> SingleK(single: Single<A>)


single val single: Single<A>


ap fun <B> ap(fa: SingleKOf<(A) -> B>): SingleK<B>
bracketCase fun <B> bracketCase(use: (A) -> SingleKOf<B>, release: (A, ExitCase<Throwable>) -> SingleKOf<Unit>): SingleK<B>
A way to safely acquire a resource and release in the face of errors and cancellation. It uses ExitCase to distinguish between different exit cases when releasing the acquired resource.
continueOn fun continueOn(ctx: CoroutineContext): SingleK<A>
equals fun equals(other: Any?): Boolean
flatMap fun <B> flatMap(f: (A) -> SingleKOf<B>): SingleK<B>
handleErrorWith fun handleErrorWith(function: (Throwable) -> SingleKOf<A>): SingleK<A>
hashCode fun hashCode(): Int
map fun <B> map(f: (A) -> B): SingleK<B>
runAsync fun runAsync(cb: (Either<Throwable, A>) -> SingleKOf<Unit>): SingleK<Unit>
runAsyncCancellable fun runAsyncCancellable(cb: (Either<Throwable, A>) -> SingleKOf<Unit>): SingleK<Disposable>

Companion Object Functions

async fun <A> async(fa: SingleKProc<A>): SingleK<A>
Creates a SingleK that’ll run SingleKProc.
asyncF fun <A> asyncF(fa: SingleKProcF<A>): SingleK<A>
defer fun <A> defer(fa: () -> SingleKOf<A>): SingleK<A>
invoke operator fun <A> invoke(fa: () -> A): SingleK<A>
just fun <A> just(a: A): SingleK<A>
raiseError fun <A> raiseError(t: Throwable): SingleK<A>
tailRecM tailrec fun <A, B> tailRecM(a: A, f: (A) -> SingleKOf<Either<A, B>>): SingleK<B>

Extension Functions

unsafeRunAsync fun <A> SingleKOf<A>.unsafeRunAsync(cb: (Either<Throwable, A>) -> Unit): Unit
Runs the SingleK asynchronously and then runs the cb. Catches all errors that may be thrown in await. Errors from cb will still throw as expected.
unsafeRunSync fun <A> SingleKOf<A>.unsafeRunSync(): A
Runs this SingleK with Single.blockingGet. Does not handle errors at all, rethrowing them if they happen.