arrow-fx / arrow.fx / QueueFactory

QueueFactory

interface ~~QueueFactory~~<F> Deprecated: The IO datatype and it’s related type classes will disappear in Arrow 0.13.0. All useful operations are offered directly over suspend functions by Arrow Fx Coroutines. https://arrow-kt.io/docs/fx/async/

Builds a QueueFactory for data type F without fixing the Queue’s A type or the Queue.BackpressureStrategy.

import arrow.fx.*
import arrow.fx.extensions.fx
import arrow.fx.extensions.io.concurrent.concurrent

//sampleStart
suspend fun main(): Unit = IO.fx {
  val factory: QueueFactory<ForIO> = Queue.factory(IO.concurrent())
  val unbounded = !factory.unbounded<Int>()
  val bounded = !factory.bounded<String>(10)
  val sliding = !factory.sliding<Double>(4)
  val dropping = !factory.dropping<Float>(4)
}.suspended()
//sampleEnd

Functions

bounded Create a Queue with BackpressureStrategy.Bounded.open fun <A> bounded(capacity: Int): Kind<F, Queue<F, A>>
CF abstract fun CF(): Concurrent<F>
dropping Create a Queue with BackpressureStrategy.Dropping.open fun <A> dropping(capacity: Int): Kind<F, Queue<F, A>>
sliding Create a Queue with BackpressureStrategy.Sliding.open fun <A> sliding(capacity: Int): Kind<F, Queue<F, A>>
unbounded Create a Queue with BackpressureStrategy.Unbounded.open fun <A> unbounded(): Kind<F, Queue<F, A>>

Companion Object Functions

invoke operator fun <F> invoke(CF: Concurrent<F>): QueueFactory<F>

Do you like Arrow?

Arrow Org
<