arrow-fx / arrow.fx.typeclasses / Concurrent

Concurrent

interface Concurrent<F> : Async<F>

Type class for async data types that are cancelable and can be started concurrently.

Properties

fx Entry point for monad bindings which enables for comprehensions. The underlying impl is based on coroutines. A coroutines is initiated and inside ConcurrentContinuation suspended yielding to Monad.flatMap. Once all the flatMap binds are completed the underlying monad is returned from the act of executing the coroutineopen val fx: ConcurrentFx<F>

Functions

bindingConcurrent Entry point for monad bindings which enables for comprehensions. The underlying impl is based on coroutines. A coroutines is initiated and inside ConcurrentCancellableContinuation suspended yielding to Monad.flatMap. Once all the flatMap binds are completed the underlying monad is returned from the act of executing the coroutineopen fun <B> bindingConcurrent(c: suspend ConcurrentContinuation<F, *>.() -> B): Kind<F, B>
cancelable Creates a cancelable F instance that executes an asynchronous process on evaluation. Derived from async and bracketCase.open fun <A> cancelable(k: ((Either<Throwable, A>) -> Unit) -> CancelToken<F>): Kind<F, A>
cancelableF Builder to create a cancelable F instance that executes an asynchronous process on evaluation. Function derived from async and bracketCase.open fun <A> cancelableF(k: ((Either<Throwable, A>) -> Unit) -> Kind<F, CancelToken<F>>): Kind<F, A>
dispatchers abstract fun dispatchers(): Dispatchers<F>
fork Create a new F that upon execution starts the receiver F within a Fiber on this@fork.abstract fun <A> Kind<F, A>.fork(ctx: CoroutineContext): Kind<F, Fiber<F, A>>open fun <A> Kind<F, A>.fork(): Kind<F, Fiber<F, A>>
MVar Create a MVar or mutable variable structure to be used for thread-safe sharing, initialized to a value a.open fun <A> MVar(a: A): Kind<F, MVar<F, A>>
Create an empty MVar or mutable variable structure to be used for thread-safe sharing.open fun <A> MVar(): Kind<F, MVar<F, A>>
parApplicative open fun parApplicative(): Applicative<F>
open fun parApplicative(ctx: CoroutineContext): Applicative<F>
parMapN Map two tasks in parallel within a new F on this@parMapN.open fun <A, B, C> CoroutineContext.parMapN(fa: Kind<F, A>, fb: Kind<F, B>, f: (A, B) -> C): Kind<F, C>open fun <A, B, C, D> CoroutineContext.parMapN(fa: Kind<F, A>, fb: Kind<F, B>, fc: Kind<F, C>, f: (A, B, C) -> D): Kind<F, D>
open fun <A, B, C, D, E> CoroutineContext.parMapN(fa: Kind<F, A>, fb: Kind<F, B>, fc: Kind<F, C>, fd: Kind<F, D>, f: (A, B, C, D) -> E): Kind<F, E>
open fun <A, B, C, D, E, G> CoroutineContext.parMapN(fa: Kind<F, A>, fb: Kind<F, B>, fc: Kind<F, C>, fd: Kind<F, D>, fe: Kind<F, E>, f: (A, B, C, D, E) -> G): Kind<F, G>
open fun <A, B, C, D, E, G, H> CoroutineContext.parMapN(fa: Kind<F, A>, fb: Kind<F, B>, fc: Kind<F, C>, fd: Kind<F, D>, fe: Kind<F, E>, fg: Kind<F, G>, f: (A, B, C, D, E, G) -> H): Kind<F, H>
open fun <A, B, C, D, E, G, H, I> CoroutineContext.parMapN(fa: Kind<F, A>, fb: Kind<F, B>, fc: Kind<F, C>, fd: Kind<F, D>, fe: Kind<F, E>, fg: Kind<F, G>, fh: Kind<F, H>, f: (A, B, C, D, E, G, H) -> I): Kind<F, I>
open fun <A, B, C, D, E, G, H, I, J> CoroutineContext.parMapN(fa: Kind<F, A>, fb: Kind<F, B>, fc: Kind<F, C>, fd: Kind<F, D>, fe: Kind<F, E>, fg: Kind<F, G>, fh: Kind<F, H>, fi: Kind<F, I>, f: (A, B, C, D, E, G, H, I) -> J): Kind<F, J>
open fun <A, B, C, D, E, G, H, I, J, K> CoroutineContext.parMapN(fa: Kind<F, A>, fb: Kind<F, B>, fc: Kind<F, C>, fd: Kind<F, D>, fe: Kind<F, E>, fg: Kind<F, G>, fh: Kind<F, H>, fi: Kind<F, I>, fj: Kind<F, J>, f: (A, B, C, D, E, G, H, I, J) -> K): Kind<F, K>
parSequence Runs all the F effects of the G structure to invert the structure from Kind<F, Kind<G, A>> to Kind<G, Kind<F, A>>.open fun <G, A> Kind<G, Kind<F, A>>.parSequence(TG: Traverse<G>, ctx: CoroutineContext): Kind<F, Kind<G, A>>open fun <G, A> Kind<G, Kind<F, A>>.parSequence(TG: Traverse<G>): Kind<F, Kind<G, A>>
open fun <A> Iterable<Kind<F, A>>.parSequence(ctx: CoroutineContext): Kind<F, List<A>>
open fun <A> Iterable<Kind<F, A>>.parSequence(): Kind<F, List<A>>
parTraverse Given a function which returns an F effect, run this effect in parallel for all the values in G.open fun <G, A, B> Kind<G, A>.parTraverse(ctx: CoroutineContext, TG: Traverse<G>, f: (A) -> Kind<F, B>): Kind<F, Kind<G, B>>open fun <G, A, B> Kind<G, A>.parTraverse(TG: Traverse<G>, f: (A) -> Kind<F, B>): Kind<F, Kind<G, B>>
open fun <A, B> Iterable<A>.parTraverse(ctx: CoroutineContext, f: (A) -> Kind<F, B>): Kind<F, List<B>>
open fun <A, B> Iterable<A>.parTraverse(f: (A) -> Kind<F, B>): Kind<F, List<B>>
Promise Create a pure Promise that is empty and can be filled exactly once.open fun <A> Promise(): Kind<F, Promise<F, A>>
raceN Race two tasks concurrently within a new F on this@raceN. At the end of the race it automatically cancels the loser.open fun <A, B> CoroutineContext.raceN(fa: Kind<F, A>, fb: Kind<F, B>): Kind<F, Race2<A, B>>open fun <A, B, C> CoroutineContext.raceN(fa: Kind<F, A>, fb: Kind<F, B>, fc: Kind<F, C>): Kind<F, Race3<out A, out B, out C>>
open fun <A, B, C, D> CoroutineContext.raceN(a: Kind<F, A>, b: Kind<F, B>, c: Kind<F, C>, d: Kind<F, D>): Kind<F, Race4<out A, out B, out C, out D>>
open fun <A, B, C, D, E> CoroutineContext.raceN(a: Kind<F, A>, b: Kind<F, B>, c: Kind<F, C>, d: Kind<F, D>, e: Kind<F, E>): Kind<F, Race5<out A, out B, out C, out D, out E>>
open fun <A, B, C, D, E, G> CoroutineContext.raceN(a: Kind<F, A>, b: Kind<F, B>, c: Kind<F, C>, d: Kind<F, D>, e: Kind<F, E>, g: Kind<F, G>): Kind<F, Race6<out A, out B, out C, out D, out E, out G>>
open fun <A, B, C, D, E, G, H> CoroutineContext.raceN(a: Kind<F, A>, b: Kind<F, B>, c: Kind<F, C>, d: Kind<F, D>, e: Kind<F, E>, g: Kind<F, G>, h: Kind<F, H>): Kind<F, Race7<out A, out B, out C, out D, out E, out G, out H>>
open fun <A, B, C, D, E, G, H, I> CoroutineContext.raceN(a: Kind<F, A>, b: Kind<F, B>, c: Kind<F, C>, d: Kind<F, D>, e: Kind<F, E>, g: Kind<F, G>, h: Kind<F, H>, i: Kind<F, I>): Kind<F, Race8<out A, out B, out C, out D, out E, out G, out H, out I>>
open fun <A, B, C, D, E, G, H, I, J> CoroutineContext.raceN(a: Kind<F, A>, b: Kind<F, B>, c: Kind<F, C>, d: Kind<F, D>, e: Kind<F, E>, g: Kind<F, G>, h: Kind<F, H>, i: Kind<F, I>, j: Kind<F, J>): Kind<F, Race9<out A, out B, out C, out D, out E, out G, out H, out I, out J>>
racePair Race two tasks concurrently within a new F. Race results in a winner and the other, yet to finish task running in a Fiber.abstract fun <A, B> CoroutineContext.racePair(fa: Kind<F, A>, fb: Kind<F, B>): Kind<F, RacePair<F, A, B>>
raceTriple Race three tasks concurrently within a new F. Race results in a winner and the others, yet to finish task running in a Fiber.abstract fun <A, B, C> CoroutineContext.raceTriple(fa: Kind<F, A>, fb: Kind<F, B>, fc: Kind<F, C>): Kind<F, RaceTriple<F, A, B, C>>
Semaphore Create a pure Semaphore that can be used to control access in a concurrent system.open fun Semaphore(n: Long): Kind<F, Semaphore<F>>
sleep Sleeps for a given duration without blocking a thread.open fun sleep(duration: Duration): Kind<F, Unit>
timer open fun timer(): Timer<F>
waitFor Returns the result of this within the specified duration or the default value.open fun <A> Kind<F, A>.waitFor(duration: Duration, default: Kind<F, A>): Kind<F, A>
Returns the result of this within the specified duration or the raises a TimeoutException exception.open fun <A> Kind<F, A>.waitFor(duration: Duration): Kind<F, A>

Inheritors

CancelableQueue class CancelableQueue<F, A> : Concurrent<F>, Queue<F, A>
ConcurrentContinuation open class ConcurrentContinuation<F, A> : AsyncContinuation<F, A>, Concurrent<F>, ConcurrentSyntax<F>
ConcurrentQueue Lightweight, asynchronous queue for values of A in a Concurrent context F A Queue can be implemented using 4 different strategiesclass ConcurrentQueue<F, A> : Concurrent<F>, Queue<F, A>
ConcurrentSyntax interface ConcurrentSyntax<F> : Concurrent<F>, AsyncSyntax<F>
IOConcurrent interface IOConcurrent : Concurrent<ForIO>, IOAsync
IODefaultConcurrent interface IODefaultConcurrent : Concurrent<ForIO>, IOConcurrent

Type Class Hierarchy

Do you like Arrow?

Arrow Org
<