arrow-effects-data / arrow.effects / IO

IO

@higherkind sealed class IO<out A> : IOOf<A>

Functions

ap fun <B> ap(ff: IOOf<(A) -> B>): IO<B>
attempt fun attempt(): IO<Either<Throwable, A>>
bracket fun <B> bracket(release: (A) -> IOOf<Unit>, use: (A) -> IOOf<B>): IO<B>
bracketCase fun <B> bracketCase(release: (A, ExitCase<Throwable>) -> IOOf<Unit>, use: (A) -> IOOf<B>): IO<B>
continueOn open fun continueOn(ctx: CoroutineContext): IO<A>
flatMap open fun <B> flatMap(f: (A) -> IOOf<B>): IO<B>
followedBy fun <B> followedBy(fb: IOOf<B>): IO<B>
guarantee fun guarantee(finalizer: IOOf<Unit>): IO<A>
guaranteeCase fun guaranteeCase(finalizer: (ExitCase<Throwable>) -> IOOf<Unit>): IO<A>
map open fun <B> map(f: (A) -> B): IO<B>
redeem fun <B> redeem(fe: (Throwable) -> B, fb: (A) -> B): IO<B>
Redeem an IO to an IO of B by resolving the error or mapping the value A to B.
redeemWith fun <B> redeemWith(fe: (Throwable) -> IOOf<B>, fb: (A) -> IOOf<B>): IO<B>
Redeem an IO to an IO of B by resolving the error or mapping the value A to B with an effect.
runAsync fun runAsync(cb: (Either<Throwable, A>) -> IOOf<Unit>): IO<Unit>
runAsyncCancellable fun runAsyncCancellable(onCancel: OnCancel = Silent, cb: (Either<Throwable, A>) -> IOOf<Unit>): IO<Disposable>
startFiber fun startFiber(ctx: CoroutineContext): IO<Fiber<ForIO, A>>
Create a new IO that upon execution starts the receiver IO within a Fiber on ctx.
uncancelable fun uncancelable(): IO<A>
Makes the source IO uncancelable such that a Fiber.cancel signal has no effect.
unsafeRunAsync fun unsafeRunAsync(cb: (Either<Throwable, A>) -> Unit): Unit
unsafeRunAsyncCancellable fun unsafeRunAsyncCancellable(onCancel: OnCancel = Silent, cb: (Either<Throwable, A>) -> Unit): Disposable
unsafeRunSync fun unsafeRunSync(): A
unsafeRunTimed fun unsafeRunTimed(limit: Duration): Option<A>

Companion Object Properties

lazy val lazy: IO<Unit>
never val never: IO<Nothing>
unit val unit: IO<Unit>

Companion Object Functions

async fun <A> async(k: IOProc<A>): IO<A>
asyncF fun <A> asyncF(k: IOProcF<A>): IO<A>
defer fun <A> defer(f: () -> IOOf<A>): IO<A>
effect fun <A> effect(f: suspend () -> A): IO<A>
fun <A> effect(ctx: CoroutineContext, f: suspend () -> A): IO<A>
eval fun <A> eval(eval: Eval<A>): IO<A>
invoke operator fun <A> invoke(f: () -> A): IO<A>
operator fun <A> invoke(ctx: CoroutineContext, f: () -> A): IO<A>
just fun <A> just(a: A): IO<A>
raiseError fun <A> raiseError(e: Throwable): IO<A>
tailRecM fun <A, B> tailRecM(a: A, f: (A) -> IOOf<Either<A, B>>): IO<B>

Extension Functions

fix fun <A> IOOf<A>.fix(): IO<A>
handleError fun <A> IOOf<A>.handleError(f: (Throwable) -> A): IO<A>
handleErrorWith fun <A> IOOf<A>.handleErrorWith(f: (Throwable) -> IOOf<A>): IO<A>
liftIO fun <A> A.liftIO(): IO<A>

Companion Object Extension Functions

racePair fun <A, B> IO.Companion.racePair(ctx: CoroutineContext, ioA: IOOf<A>, ioB: IOOf<B>): IO<RacePair<ForIO, A, B>>
Race two tasks concurrently within a new IO. Race results in a winner and the other, yet to finish task running in a Fiber.
raceTriple fun <A, B, C> IO.Companion.raceTriple(ctx: CoroutineContext, ioA: IOOf<A>, ioB: IOOf<B>, ioC: IOOf<C>): IO<RaceTriple<ForIO, A, B, C>>
Race three tasks concurrently within a new IO. Race results in a winner and the others, yet to finish task running in a Fiber.