arrow-fx / arrow.fx / Queue / unbounded
fun <F, A> unbounded(CF:
Concurrent
<F>): Kind<F,
Queue
<F, A>>
Create a Queue with BackpressureStrategy.Unbounded.
An unbounded queue has no notion of capacity and is bound only by exhausting the memory limits of the runtime.
import arrow.fx.*
import arrow.fx.extensions.fx
import arrow.fx.extensions.io.concurrent.concurrent
suspend fun main(args: Array<String>): Unit = IO.fx {
val q = !Queue.unbounded<ForIO, Int>(IO.concurrent())
!q.offer(42)
// ...
!q.offer(42000000)
val res = !q.take()
!effect { println(res) }
}.suspended()
Do you like Arrow?
✖