(self: TxQueueState): Effect.Effect<boolean>Checks whether the queue is empty.
Example (Checking whether a queue is empty)
import { Effect, TxQueue } from "effect"
const program = Effect.gen(function*() {
const queue = yield* TxQueue.bounded<number>(10)
const empty = yield* TxQueue.isEmpty(queue)
console.log(empty) // true
yield* TxQueue.offer(queue, 42)
const stillEmpty = yield* TxQueue.isEmpty(queue)
console.log(stillEmpty) // false
})export const const isEmpty: (
self: TxQueueState
) => Effect.Effect<boolean>
Checks whether the queue is empty.
Example (Checking whether a queue is empty)
import { Effect, TxQueue } from "effect"
const program = Effect.gen(function*() {
const queue = yield* TxQueue.bounded<number>(10)
const empty = yield* TxQueue.isEmpty(queue)
console.log(empty) // true
yield* TxQueue.offer(queue, 42)
const stillEmpty = yield* TxQueue.isEmpty(queue)
console.log(stillEmpty) // false
})
isEmpty = (self: TxQueueState(parameter) self: {
strategy: "bounded" | "unbounded" | "dropping" | "sliding";
capacity: number;
items: TxChunk.TxChunk<any>;
stateRef: TxRef.TxRef<State<any, any>>;
toString: () => string;
toJSON: () => unknown;
}
self: TxQueueState): import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<boolean> => import TxChunkTxChunk.const isEmpty: <A>(
self: TxChunk<A>
) => Effect.Effect<boolean>
Checks whether the TxChunk is empty.
Example (Checking for an empty chunk)
import { Effect, TxChunk } from "effect"
const program = Effect.gen(function*() {
const emptyChunk = yield* TxChunk.empty<number>()
const nonEmptyChunk = yield* TxChunk.fromIterable([1, 2, 3])
// Check if chunks are empty - automatically transactional
const isEmpty1 = yield* TxChunk.isEmpty(emptyChunk)
const isEmpty2 = yield* TxChunk.isEmpty(nonEmptyChunk)
console.log(isEmpty1) // true
console.log(isEmpty2) // false
})
isEmpty(self: TxQueueState(parameter) self: {
strategy: "bounded" | "unbounded" | "dropping" | "sliding";
capacity: number;
items: TxChunk.TxChunk<any>;
stateRef: TxRef.TxRef<State<any, any>>;
toString: () => string;
toJSON: () => unknown;
}
self.TxQueueState.items: TxChunk.TxChunk<any>(property) TxQueueState.items: {
ref: TxRef.TxRef<Chunk.Chunk<A>>;
toString: () => string;
toJSON: () => unknown;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
items)