//arrow-fx-coroutines/arrow.fx.coroutines/Resource/Defer

Defer

common class Defer<A>(val resource: suspend () -> Resource<A>) : Resource<A>

Constructors

   
Defer common fun <A> Defer(resource: suspend () -> Resource<A>)

Functions

Name Summary
ap common fun <B> ap(ff: Resource<(A) -> B>): Resource<B>
flatMap common fun <B> flatMap(f: (A) -> Resource<B>): Resource<B>
Create a resource value of B from a resource A by mapping f.
map common fun <B> map(f: suspend (A) -> B): Resource<B>
parZip common fun <B, C> parZip(fb: Resource<B>, f: suspend (A, B) -> C): Resource<C>
common fun <B, C> parZip(ctx: CoroutineContext = Dispatchers.Default, fb: Resource<B>, f: suspend (A, B) -> C): Resource<C>
Composes two Resources together by zipping them in parallel, by running both their acquire handlers in parallel, and both release handlers in parallel.
tap common fun tap(f: suspend (A) -> Unit): Resource<A>
Useful for setting up/configuring an acquired resource
use common infix suspend tailrec fun <B> use(f: suspend (A) -> B): B
Use the created resource When done will run all finalizers
zip common fun <B> zip(other: Resource<B>): Resource<Pair<A, B»
inline fun <B, C> zip(other: Resource<B>, crossinline combine: (A, B) -> C): Resource<C>
inline fun <B, C, D, E> zip(b: Resource<B>, c: Resource<C>, d: Resource<D>, crossinline map: (A, B, C, D) -> E): Resource<E>
inline fun <B, C, D, E, F, G> zip(b: Resource<B>, c: Resource<C>, d: Resource<D>, e: Resource<E>, crossinline map: (A, B, C, D, E) -> G): Resource<G>
inline fun <B, C, D, E, F, G, H> zip(b: Resource<B>, c: Resource<C>, d: Resource<D>, e: Resource<E>, f: Resource<F>, crossinline map: (A, B, C, D, E, F) -> G): Resource<G>
inline fun <B, C, D, E, F, G, H> zip(b: Resource<B>, c: Resource<C>, d: Resource<D>, e: Resource<E>, f: Resource<F>, g: Resource<G>, crossinline map: (A, B, C, D, E, F, G) -> H): Resource<H>
inline fun <B, C, D, E, F, G, H, I> zip(b: Resource<B>, c: Resource<C>, d: Resource<D>, e: Resource<E>, f: Resource<F>, g: Resource<G>, h: Resource<H>, crossinline map: (A, B, C, D, E, F, G, H) -> I): Resource<I>
inline fun <B, C, D, E, F, G, H, I, J> zip(b: Resource<B>, c: Resource<C>, d: Resource<D>, e: Resource<E>, f: Resource<F>, g: Resource<G>, h: Resource<H>, i: Resource<I>, crossinline map: (A, B, C, D, E, F, G, H, I) -> J): Resource<J>
inline fun <B, C, D, E, F, G, H, I, J, K> zip(b: Resource<B>, c: Resource<C>, d: Resource<D>, e: Resource<E>, f: Resource<F>, g: Resource<G>, h: Resource<H>, i: Resource<I>, j: Resource<J>, crossinline map: (A, B, C, D, E, F, G, H, I, J) -> K): Resource<K>
common inline fun <B, C, D> zip(b: Resource<B>, c: Resource<C>, crossinline map: (A, B, C) -> D): Resource<D>
Combines two independent resource values with the provided map function, returning the resulting immutable Resource value. The finalizers run in order of left to right by using flatMap under the hood, but zip provides a nicer syntax for combining values that don’t depend on each-other.

Properties

Name Summary
resource common val resource: suspend () -> Resource<A>

Do you like Arrow?

Arrow Org
<