<AR, ER, RR, AL, A>(
right: Stream<AR, ER, RR>,
f: (
left: Arr.NonEmptyReadonlyArray<AL>,
right: Arr.NonEmptyReadonlyArray<AR>
) => readonly [
output: Arr.NonEmptyReadonlyArray<A>,
leftoverLeft: ReadonlyArray<AL>,
leftoverRight: ReadonlyArray<AR>
]
): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>
<AL, EL, RL, AR, ER, RR, A>(
left: Stream<AL, EL, RL>,
right: Stream<AR, ER, RR>,
f: (
left: Arr.NonEmptyReadonlyArray<AL>,
right: Arr.NonEmptyReadonlyArray<AR>
) => readonly [
output: Arr.NonEmptyReadonlyArray<A>,
leftoverLeft: ReadonlyArray<AL>,
leftoverRight: ReadonlyArray<AR>
]
): Stream<A, EL | ER, RL | RR>Zips two streams by applying a function to non-empty arrays of elements.
Details
The function returns output plus leftover arrays that carry into the next pull.
Example (Zipping stream chunks)
import { Array, Console, Effect, Stream } from "effect"
const left = Stream.fromArrays([1, 2, 3], [4, 5])
const right = Stream.fromArrays(["a", "b"], ["c", "d", "e"])
const zipped = Stream.zipWithArray(left, right, (leftChunk, rightChunk) => {
const minLength = Math.min(leftChunk.length, rightChunk.length)
const output = Array.makeBy(minLength, (i) => [leftChunk[i], rightChunk[i]] as const)
return [output, leftChunk.slice(minLength), rightChunk.slice(minLength)]
})
const program = Effect.gen(function*() {
const result = yield* Stream.runCollect(zipped)
yield* Console.log(result)
})
Effect.runPromise(program)
// Output: [[1, "a"], [2, "b"], [3, "c"], [4, "d"], [5, "e"]]export const const zipWithArray: {
<AR, ER, RR, AL, A>(
right: Stream<AR, ER, RR>,
f: (
left: Arr.NonEmptyReadonlyArray<AL>,
right: Arr.NonEmptyReadonlyArray<AR>
) => readonly [
output: Arr.NonEmptyReadonlyArray<A>,
leftoverLeft: ReadonlyArray<AL>,
leftoverRight: ReadonlyArray<AR>
]
): <EL, RL>(
left: Stream<AL, EL, RL>
) => Stream<A, EL | ER, RL | RR>
<AL, EL, RL, AR, ER, RR, A>(
left: Stream<AL, EL, RL>,
right: Stream<AR, ER, RR>,
f: (
left: Arr.NonEmptyReadonlyArray<AL>,
right: Arr.NonEmptyReadonlyArray<AR>
) => readonly [
output: Arr.NonEmptyReadonlyArray<A>,
leftoverLeft: ReadonlyArray<AL>,
leftoverRight: ReadonlyArray<AR>
]
): Stream<A, EL | ER, RL | RR>
}
Zips two streams by applying a function to non-empty arrays of elements.
Details
The function returns output plus leftover arrays that carry into the next pull.
Example (Zipping stream chunks)
import { Array, Console, Effect, Stream } from "effect"
const left = Stream.fromArrays([1, 2, 3], [4, 5])
const right = Stream.fromArrays(["a", "b"], ["c", "d", "e"])
const zipped = Stream.zipWithArray(left, right, (leftChunk, rightChunk) => {
const minLength = Math.min(leftChunk.length, rightChunk.length)
const output = Array.makeBy(minLength, (i) => [leftChunk[i], rightChunk[i]] as const)
return [output, leftChunk.slice(minLength), rightChunk.slice(minLength)]
})
const program = Effect.gen(function*() {
const result = yield* Stream.runCollect(zipped)
yield* Console.log(result)
})
Effect.runPromise(program)
// Output: [[1, "a"], [2, "b"], [3, "c"], [4, "d"], [5, "e"]]
zipWithArray: {
<function (type parameter) AR in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>AR, function (type parameter) ER in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>ER, function (type parameter) RR in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>RR, function (type parameter) AL in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>AL, function (type parameter) A in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>A>(
right: Stream<AR, ER, RR>(parameter) right: {
channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>;
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; <…;
}
right: interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) AR in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>AR, function (type parameter) ER in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>ER, function (type parameter) RR in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>RR>,
f: (
left: Arr.NonEmptyReadonlyArray<AL>,
right: Arr.NonEmptyReadonlyArray<AR>
) => readonly [
output: Arr.NonEmptyReadonlyArray<A>,
leftoverLeft: ReadonlyArray<AL>,
leftoverRight: ReadonlyArray<AR>
]
f: (
left: Arr.NonEmptyReadonlyArray<AL>(parameter) left: {
0: AL;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AL>>): Array<AL>; (...items: Array<AL | ConcatArray<AL>>): Array<AL> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AL>;
indexOf: (searchElement: AL, fromIndex?: number) => number;
lastIndexOf: (searchElement: AL, fromIndex?: number) => number;
every: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): Array<AL> };
reduce: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
reduceRight: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
find: { (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findIndex: (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AL]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AL>;
includes: (searchElement: AL, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AL, index: number, array: Array<AL>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AL | undefined;
findLast: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findLastIndex: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AL>;
toSorted: (compareFn?: ((a: AL, b: AL) => number) | undefined) => Array<AL>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AL>): Array<AL>; (start: number, deleteCount?: number): Array<AL> };
with: (index: number, value: AL) => Array<AL>;
}
left: import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) AL in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>AL>,
right: Arr.NonEmptyReadonlyArray<AR>(parameter) right: {
0: AR;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AR>>): Array<AR>; (...items: Array<AR | ConcatArray<AR>>): Array<AR> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AR>;
indexOf: (searchElement: AR, fromIndex?: number) => number;
lastIndexOf: (searchElement: AR, fromIndex?: number) => number;
every: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): Array<AR> };
reduce: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
reduceRight: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
find: { (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findIndex: (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AR]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AR>;
includes: (searchElement: AR, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AR, index: number, array: Array<AR>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AR | undefined;
findLast: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findLastIndex: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AR>;
toSorted: (compareFn?: ((a: AR, b: AR) => number) | undefined) => Array<AR>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AR>): Array<AR>; (start: number, deleteCount?: number): Array<AR> };
with: (index: number, value: AR) => Array<AR>;
}
right: import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) AR in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>AR>
) => readonly [
readonly [A, ...A[]]output: import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) A in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>A>,
readonly AL[]leftoverLeft: interface ReadonlyArray<T>ReadonlyArray<function (type parameter) AL in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>AL>,
readonly AR[]leftoverRight: interface ReadonlyArray<T>ReadonlyArray<function (type parameter) AR in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>AR>
]
): <function (type parameter) EL in <EL, RL>(left: Stream<AL, EL, RL>): Stream<A, EL | ER, RL | RR>EL, function (type parameter) RL in <EL, RL>(left: Stream<AL, EL, RL>): Stream<A, EL | ER, RL | RR>RL>(left: Stream<AL, EL, RL>(parameter) left: {
channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>;
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; <…;
}
left: interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) AL in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>AL, function (type parameter) EL in <EL, RL>(left: Stream<AL, EL, RL>): Stream<A, EL | ER, RL | RR>EL, function (type parameter) RL in <EL, RL>(left: Stream<AL, EL, RL>): Stream<A, EL | ER, RL | RR>RL>) => interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) A in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>A, function (type parameter) EL in <EL, RL>(left: Stream<AL, EL, RL>): Stream<A, EL | ER, RL | RR>EL | function (type parameter) ER in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>ER, function (type parameter) RL in <EL, RL>(left: Stream<AL, EL, RL>): Stream<A, EL | ER, RL | RR>RL | function (type parameter) RR in <AR, ER, RR, AL, A>(right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): <EL, RL>(left: Stream<AL, EL, RL>) => Stream<A, EL | ER, RL | RR>RR>
<function (type parameter) AL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AL, function (type parameter) EL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>EL, function (type parameter) RL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RL, function (type parameter) AR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AR, function (type parameter) ER in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>ER, function (type parameter) RR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RR, function (type parameter) A in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>A>(
left: Stream<AL, EL, RL>(parameter) left: {
channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>;
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; <…;
}
left: interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) AL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AL, function (type parameter) EL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>EL, function (type parameter) RL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RL>,
right: Stream<AR, ER, RR>(parameter) right: {
channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>;
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; <…;
}
right: interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) AR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AR, function (type parameter) ER in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>ER, function (type parameter) RR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RR>,
f: (
left: Arr.NonEmptyReadonlyArray<AL>,
right: Arr.NonEmptyReadonlyArray<AR>
) => readonly [
output: Arr.NonEmptyReadonlyArray<A>,
leftoverLeft: ReadonlyArray<AL>,
leftoverRight: ReadonlyArray<AR>
]
f: (
left: Arr.NonEmptyReadonlyArray<AL>(parameter) left: {
0: AL;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AL>>): Array<AL>; (...items: Array<AL | ConcatArray<AL>>): Array<AL> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AL>;
indexOf: (searchElement: AL, fromIndex?: number) => number;
lastIndexOf: (searchElement: AL, fromIndex?: number) => number;
every: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): Array<AL> };
reduce: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
reduceRight: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
find: { (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findIndex: (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AL]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AL>;
includes: (searchElement: AL, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AL, index: number, array: Array<AL>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AL | undefined;
findLast: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findLastIndex: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AL>;
toSorted: (compareFn?: ((a: AL, b: AL) => number) | undefined) => Array<AL>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AL>): Array<AL>; (start: number, deleteCount?: number): Array<AL> };
with: (index: number, value: AL) => Array<AL>;
}
left: import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) AL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AL>,
right: Arr.NonEmptyReadonlyArray<AR>(parameter) right: {
0: AR;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AR>>): Array<AR>; (...items: Array<AR | ConcatArray<AR>>): Array<AR> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AR>;
indexOf: (searchElement: AR, fromIndex?: number) => number;
lastIndexOf: (searchElement: AR, fromIndex?: number) => number;
every: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): Array<AR> };
reduce: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
reduceRight: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
find: { (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findIndex: (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AR]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AR>;
includes: (searchElement: AR, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AR, index: number, array: Array<AR>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AR | undefined;
findLast: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findLastIndex: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AR>;
toSorted: (compareFn?: ((a: AR, b: AR) => number) | undefined) => Array<AR>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AR>): Array<AR>; (start: number, deleteCount?: number): Array<AR> };
with: (index: number, value: AR) => Array<AR>;
}
right: import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) AR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AR>
) => readonly [
readonly [A, ...A[]]output: import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) A in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>A>,
readonly AL[]leftoverLeft: interface ReadonlyArray<T>ReadonlyArray<function (type parameter) AL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AL>,
readonly AR[]leftoverRight: interface ReadonlyArray<T>ReadonlyArray<function (type parameter) AR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AR>
]
): interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) A in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>A, function (type parameter) EL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>EL | function (type parameter) ER in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>ER, function (type parameter) RL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RL | function (type parameter) RR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RR>
} = dual<(...args: Array<any>) => any, <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]) => Stream<A, EL | ER, RL | RR>>(arity: 3, body: <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]) => Stream<A, EL | ER, RL | RR>): ((...args: Array<any>) => any) & (<AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]) => Stream<A, EL | ER, RL | RR>) (+1 overload)Creates a function that can be called in data-first style or data-last
(pipe-friendly) style.
When to use
Use to expose one implementation through both direct and pipe-friendly
call styles.
Details
Pass either the arity of the uncurried function or a predicate that decides
whether the current call is data-first. Arity is the common case. Use a
predicate when optional arguments make arity ambiguous.
Example (Selecting data-first or data-last style by arity)
import { Function, pipe } from "effect"
const sum = Function.dual<
(that: number) => (self: number) => number,
(self: number, that: number) => number
>(2, (self, that) => self + that)
console.log(sum(2, 3)) // 5
console.log(pipe(2, sum(3))) // 5
Example (Defining overloads with call signatures)
import { Function, pipe } from "effect"
const sum: {
(that: number): (self: number) => number
(self: number, that: number): number
} = Function.dual(2, (self: number, that: number): number => self + that)
console.log(sum(2, 3)) // 5
console.log(pipe(2, sum(3))) // 5
Example (Selecting data-first or data-last style with a predicate)
import { Function, pipe } from "effect"
const sum = Function.dual<
(that: number) => (self: number) => number,
(self: number, that: number) => number
>(
(args) => args.length === 2,
(self, that) => self + that
)
console.log(sum(2, 3)) // 5
console.log(pipe(2, sum(3))) // 5
dual(3, <function (type parameter) AL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AL, function (type parameter) EL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>EL, function (type parameter) RL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RL, function (type parameter) AR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AR, function (type parameter) ER in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>ER, function (type parameter) RR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RR, function (type parameter) A in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>A>(
left: Stream<AL, EL, RL>(parameter) left: {
channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>;
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; <…;
}
left: interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) AL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AL, function (type parameter) EL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>EL, function (type parameter) RL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RL>,
right: Stream<AR, ER, RR>(parameter) right: {
channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>;
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; <…;
}
right: interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) AR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AR, function (type parameter) ER in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>ER, function (type parameter) RR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RR>,
f: (
left: Arr.NonEmptyReadonlyArray<AL>,
right: Arr.NonEmptyReadonlyArray<AR>
) => readonly [
output: Arr.NonEmptyReadonlyArray<A>,
leftoverLeft: ReadonlyArray<AL>,
leftoverRight: ReadonlyArray<AR>
]
f: (
left: Arr.NonEmptyReadonlyArray<AL>(parameter) left: {
0: AL;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AL>>): Array<AL>; (...items: Array<AL | ConcatArray<AL>>): Array<AL> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AL>;
indexOf: (searchElement: AL, fromIndex?: number) => number;
lastIndexOf: (searchElement: AL, fromIndex?: number) => number;
every: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): Array<AL> };
reduce: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
reduceRight: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
find: { (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findIndex: (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AL]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AL>;
includes: (searchElement: AL, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AL, index: number, array: Array<AL>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AL | undefined;
findLast: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findLastIndex: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AL>;
toSorted: (compareFn?: ((a: AL, b: AL) => number) | undefined) => Array<AL>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AL>): Array<AL>; (start: number, deleteCount?: number): Array<AL> };
with: (index: number, value: AL) => Array<AL>;
}
left: import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) AL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AL>,
right: Arr.NonEmptyReadonlyArray<AR>(parameter) right: {
0: AR;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AR>>): Array<AR>; (...items: Array<AR | ConcatArray<AR>>): Array<AR> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AR>;
indexOf: (searchElement: AR, fromIndex?: number) => number;
lastIndexOf: (searchElement: AR, fromIndex?: number) => number;
every: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): Array<AR> };
reduce: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
reduceRight: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
find: { (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findIndex: (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AR]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AR>;
includes: (searchElement: AR, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AR, index: number, array: Array<AR>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AR | undefined;
findLast: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findLastIndex: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AR>;
toSorted: (compareFn?: ((a: AR, b: AR) => number) | undefined) => Array<AR>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AR>): Array<AR>; (start: number, deleteCount?: number): Array<AR> };
with: (index: number, value: AR) => Array<AR>;
}
right: import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) AR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AR>
) => readonly [
readonly [A, ...A[]]output: import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) A in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>A>,
readonly AL[]leftoverLeft: interface ReadonlyArray<T>ReadonlyArray<function (type parameter) AL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AL>,
readonly AR[]leftoverRight: interface ReadonlyArray<T>ReadonlyArray<function (type parameter) AR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AR>
]
): interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<function (type parameter) A in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>A, function (type parameter) EL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>EL | function (type parameter) ER in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>ER, function (type parameter) RL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RL | function (type parameter) RR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RR> =>
const fromChannel: <
Arr extends Arr.NonEmptyReadonlyArray<any>,
E,
R
>(
channel: Channel.Channel<
Arr,
E,
void,
unknown,
unknown,
unknown,
R
>
) => Stream<
Arr extends Arr.NonEmptyReadonlyArray<infer A>
? A
: never,
E,
R
>
Creates a stream from a array-emitting Channel.
Example (Creating a stream from an array-emitting channel)
import { Channel, Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
const channel = Channel.succeed([1, 2, 3] as const)
const stream = Stream.fromChannel(channel)
const result = yield* Stream.runCollect(stream)
yield* Console.log(result)
})
// Output: [ 1, 2, 3 ]
fromChannel(import ChannelChannel.const fromTransformBracket: <
OutElem,
OutErr,
OutDone,
InElem,
InErr,
InDone,
EX,
EnvX,
Env
>(
f: (
upstream: Pull.Pull<InElem, InErr, InDone>,
scope: Scope.Scope,
forkedScope: Scope.Scope
) => Effect.Effect<
Pull.Pull<OutElem, OutErr, OutDone, EnvX>,
EX,
Env
>
) => Channel<
OutElem,
Pull.ExcludeDone<OutErr> | EX,
OutDone,
InElem,
InErr,
InDone,
Env | EnvX
>
Creates a Channel from a transformation function that operates on upstream
pulls, but also provides a forked scope that closes when the resulting
Channel completes.
When to use
Use when building channels that require scoped resource lifecycle management,
providing both the channel scope and a forked scope that automatically closes
when the channel completes.
fromTransformBracket(import EffectEffect.const fnUntraced: <Effect.Effect<Pull.Pull<readonly [AL, ...AL[]], EL, void, RL>, never, RL> | Effect.Effect<Pull.Pull<readonly [AR, ...AR[]], ER, void, RR>, never, RR>, Effect.Effect<readonly [A, ...A[]], Cause.Done<void> | EL | ER, RL | RR>, [_: Pull.Pull<unknown, unknown, unknown, never>, scope: Scope.Scope]>(body: (this: unassigned, _: Pull.Pull<unknown, unknown, unknown, never>, scope: Scope.Scope) => Generator<Effect.Effect<Pull.Pull<readonly [AL, ...AL[]], EL, void, RL>, never, RL> | Effect.Effect<...>, Effect.Effect<...>, never>) => (_: Pull.Pull<...>, scope: Scope.Scope) => Effect.Effect<...> (+41 overloads)fnUntraced(function*(_: Pull.Pull<
unknown,
unknown,
unknown,
never
>
(parameter) _: {
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; <…;
toString: () => string;
toJSON: () => unknown;
}
_, scope: Scope.Scope(parameter) scope: {
strategy: "sequential" | "parallel";
state: State.Open | State.Closed | State.Empty;
}
scope) {
const const pullLeft: Pull.Pull<
readonly [AL, ...AL[]],
EL,
void,
RL
>
const pullLeft: {
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; <…;
toString: () => string;
toJSON: () => unknown;
}
pullLeft = yield* import ChannelChannel.const toPullScoped: <
OutElem,
OutErr,
OutDone,
Env
>(
self: Channel<
OutElem,
OutErr,
OutDone,
unknown,
unknown,
unknown,
Env
>,
scope: Scope.Scope
) => Effect.Effect<
Pull.Pull<OutElem, OutErr, OutDone, Env>,
never,
Env
>
Converts a channel to a Pull within an existing scope.
Example (Converting channels to scoped pulls)
import { Channel, Data, Effect, Scope } from "effect"
class ScopedPullError extends Data.TaggedError("ScopedPullError")<{
readonly reason: string
}> {}
// Create a channel
const numbersChannel = Channel.fromIterable([1, 2, 3])
// Convert to Pull with explicit scope
const scopedPullEffect = Effect.gen(function*() {
const scope = yield* Scope.make()
const pull = yield* Channel.toPullScoped(numbersChannel, scope)
return pull
})
toPullScoped(left: Stream<AL, EL, RL>(parameter) left: {
channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>;
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; <…;
}
left.Stream<AL, EL, RL>.channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>(property) Stream<AL, EL, RL>.channel: {
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; <…;
}
channel, scope: Scope.Scope(parameter) scope: {
strategy: "sequential" | "parallel";
state: State.Open | State.Closed | State.Empty;
}
scope)
const const pullRight: Pull.Pull<
readonly [AR, ...AR[]],
ER,
void,
RR
>
const pullRight: {
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; <…;
toString: () => string;
toJSON: () => unknown;
}
pullRight = yield* import ChannelChannel.const toPullScoped: <
OutElem,
OutErr,
OutDone,
Env
>(
self: Channel<
OutElem,
OutErr,
OutDone,
unknown,
unknown,
unknown,
Env
>,
scope: Scope.Scope
) => Effect.Effect<
Pull.Pull<OutElem, OutErr, OutDone, Env>,
never,
Env
>
Converts a channel to a Pull within an existing scope.
Example (Converting channels to scoped pulls)
import { Channel, Data, Effect, Scope } from "effect"
class ScopedPullError extends Data.TaggedError("ScopedPullError")<{
readonly reason: string
}> {}
// Create a channel
const numbersChannel = Channel.fromIterable([1, 2, 3])
// Convert to Pull with explicit scope
const scopedPullEffect = Effect.gen(function*() {
const scope = yield* Scope.make()
const pull = yield* Channel.toPullScoped(numbersChannel, scope)
return pull
})
toPullScoped(right: Stream<AR, ER, RR>(parameter) right: {
channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>;
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; <…;
}
right.Stream<AR, ER, RR>.channel: Channel.Channel<Arr.NonEmptyReadonlyArray<A>, E, void, unknown, unknown, unknown, R>(property) Stream<AR, ER, RR>.channel: {
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; <…;
}
channel, scope: Scope.Scope(parameter) scope: {
strategy: "sequential" | "parallel";
state: State.Open | State.Closed | State.Empty;
}
scope)
const const pullBoth: Effect.Effect<
[
readonly [AL, ...AL[]],
readonly [AR, ...AR[]]
],
never,
RL | RR
>
const pullBoth: {
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; <…;
toString: () => string;
toJSON: () => unknown;
}
pullBoth = import EffectEffect.const gen: {
<Eff extends Effect<any, any, any>, AEff>(
f: () => Generator<Eff, AEff, never>
): Effect<
AEff,
[Eff] extends [never]
? never
: [Eff] extends [
Effect<infer _A, infer E, infer _R>
]
? E
: never,
[Eff] extends [never]
? never
: [Eff] extends [
Effect<infer _A, infer _E, infer R>
]
? R
: never
>
<Self, Eff extends Effect<any, any, any>, AEff>(
options: { readonly self: Self },
f: (this: Self) => Generator<Eff, AEff, never>
): Effect<
AEff,
[Eff] extends [never]
? never
: [Eff] extends [
Effect<infer _A, infer E, infer _R>
]
? E
: never,
[Eff] extends [never]
? never
: [Eff] extends [
Effect<infer _A, infer _E, infer R>
]
? R
: never
>
}
gen(function*() {
const const fiberLeft: Fiber.Fiber<
readonly [AL, ...AL[]],
Cause.Done<void> | EL
>
const fiberLeft: {
id: number;
currentOpCount: number;
getRef: <A>(ref: Context.Reference<A>) => A;
context: Context.Context<never>;
setContext: (context: Context.Context<never>) => void;
currentScheduler: Scheduler;
currentDispatcher: SchedulerDispatcher;
currentSpan: AnySpan | undefined;
currentLogLevel: LogLevel;
minimumLogLevel: LogLevel;
currentStackFrame: StackFrame | undefined;
maxOpsBeforeYield: number;
currentPreventYield: boolean;
addObserver: (cb: (exit: Exit<A, E>) => void) => () => void;
interruptUnsafe: (fiberId?: number | undefined, annotations?: Context.Context<never> | undefined) => void;
pollUnsafe: () => Exit<A, E> | undefined;
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; <…;
}
fiberLeft = yield* import EffectEffect.const forkIn: {
(
scope: Scope,
options?: {
readonly startImmediately?:
| boolean
| undefined
readonly uninterruptible?:
| boolean
| "inherit"
| undefined
}
): <A, E, R>(
self: Effect<A, E, R>
) => Effect<Fiber<A, E>, never, R>
<A, E, R>(
self: Effect<A, E, R>,
scope: Scope,
options?: {
readonly startImmediately?:
| boolean
| undefined
readonly uninterruptible?:
| boolean
| "inherit"
| undefined
}
): Effect<Fiber<A, E>, never, R>
}
forkIn(const pullLeft: Pull.Pull<
readonly [AL, ...AL[]],
EL,
void,
RL
>
const pullLeft: {
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; <…;
toString: () => string;
toJSON: () => unknown;
}
pullLeft, scope: Scope.Scope(parameter) scope: {
strategy: "sequential" | "parallel";
state: State.Open | State.Closed | State.Empty;
}
scope)
const const fiberRight: Fiber.Fiber<
readonly [AR, ...AR[]],
Cause.Done<void> | ER
>
const fiberRight: {
id: number;
currentOpCount: number;
getRef: <A>(ref: Context.Reference<A>) => A;
context: Context.Context<never>;
setContext: (context: Context.Context<never>) => void;
currentScheduler: Scheduler;
currentDispatcher: SchedulerDispatcher;
currentSpan: AnySpan | undefined;
currentLogLevel: LogLevel;
minimumLogLevel: LogLevel;
currentStackFrame: StackFrame | undefined;
maxOpsBeforeYield: number;
currentPreventYield: boolean;
addObserver: (cb: (exit: Exit<A, E>) => void) => () => void;
interruptUnsafe: (fiberId?: number | undefined, annotations?: Context.Context<never> | undefined) => void;
pollUnsafe: () => Exit<A, E> | undefined;
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; <…;
}
fiberRight = yield* import EffectEffect.const forkIn: {
(
scope: Scope,
options?: {
readonly startImmediately?:
| boolean
| undefined
readonly uninterruptible?:
| boolean
| "inherit"
| undefined
}
): <A, E, R>(
self: Effect<A, E, R>
) => Effect<Fiber<A, E>, never, R>
<A, E, R>(
self: Effect<A, E, R>,
scope: Scope,
options?: {
readonly startImmediately?:
| boolean
| undefined
readonly uninterruptible?:
| boolean
| "inherit"
| undefined
}
): Effect<Fiber<A, E>, never, R>
}
forkIn(const pullRight: Pull.Pull<
readonly [AR, ...AR[]],
ER,
void,
RR
>
const pullRight: {
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; <…;
toString: () => string;
toJSON: () => unknown;
}
pullRight, scope: Scope.Scope(parameter) scope: {
strategy: "sequential" | "parallel";
state: State.Open | State.Closed | State.Empty;
}
scope)
return (yield* import FiberFiber.const joinAll: <
A extends Iterable<Fiber<any, any>>
>(
self: A
) => Effect<
Arr.ReadonlyArray.With<
A,
A extends Iterable<Fiber<infer _A, infer _E>>
? _A
: never
>,
A extends Fiber<infer _A, infer _E> ? _E : never
>
Waits for all fibers to succeed and returns their values in input order.
When to use
Use when you need every fiber to succeed and want the successful values
rather than the Exit values.
Details
If any fiber fails, the returned Effect fails with that fiber's cause and
stops waiting for additional results. This does not interrupt the remaining
fibers.
Gotchas
A failure stops waiting, but it does not interrupt any other fibers. Use
interruptAll
separately when remaining fibers should be stopped.
joinAll([const fiberLeft: Fiber.Fiber<
readonly [AL, ...AL[]],
Cause.Done<void> | EL
>
const fiberLeft: {
id: number;
currentOpCount: number;
getRef: <A>(ref: Context.Reference<A>) => A;
context: Context.Context<never>;
setContext: (context: Context.Context<never>) => void;
currentScheduler: Scheduler;
currentDispatcher: SchedulerDispatcher;
currentSpan: AnySpan | undefined;
currentLogLevel: LogLevel;
minimumLogLevel: LogLevel;
currentStackFrame: StackFrame | undefined;
maxOpsBeforeYield: number;
currentPreventYield: boolean;
addObserver: (cb: (exit: Exit<A, E>) => void) => () => void;
interruptUnsafe: (fiberId?: number | undefined, annotations?: Context.Context<never> | undefined) => void;
pollUnsafe: () => Exit<A, E> | undefined;
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; <…;
}
fiberLeft, const fiberRight: Fiber.Fiber<
readonly [AR, ...AR[]],
Cause.Done<void> | ER
>
const fiberRight: {
id: number;
currentOpCount: number;
getRef: <A>(ref: Context.Reference<A>) => A;
context: Context.Context<never>;
setContext: (context: Context.Context<never>) => void;
currentScheduler: Scheduler;
currentDispatcher: SchedulerDispatcher;
currentSpan: AnySpan | undefined;
currentLogLevel: LogLevel;
minimumLogLevel: LogLevel;
currentStackFrame: StackFrame | undefined;
maxOpsBeforeYield: number;
currentPreventYield: boolean;
addObserver: (cb: (exit: Exit<A, E>) => void) => () => void;
interruptUnsafe: (fiberId?: number | undefined, annotations?: Context.Context<never> | undefined) => void;
pollUnsafe: () => Exit<A, E> | undefined;
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; <…;
}
fiberRight])) as [
import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) AL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AL>,
import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) AR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AR>
]
})
type type State =
| {
_tag: "PullBoth"
}
| {
_tag: "PullLeft"
rightArray: Arr.NonEmptyReadonlyArray<AR>
}
| {
_tag: "PullRight"
leftArray: Arr.NonEmptyReadonlyArray<AL>
}
State =
| { _tag: "PullBoth"_tag: "PullBoth" }
| { _tag: "PullLeft"_tag: "PullLeft"; rightArray: Arr.NonEmptyReadonlyArray<AR>(property) rightArray: {
0: AR;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AR>>): Array<AR>; (...items: Array<AR | ConcatArray<AR>>): Array<AR> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AR>;
indexOf: (searchElement: AR, fromIndex?: number) => number;
lastIndexOf: (searchElement: AR, fromIndex?: number) => number;
every: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): Array<AR> };
reduce: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
reduceRight: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
find: { (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findIndex: (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AR]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AR>;
includes: (searchElement: AR, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AR, index: number, array: Array<AR>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AR | undefined;
findLast: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findLastIndex: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AR>;
toSorted: (compareFn?: ((a: AR, b: AR) => number) | undefined) => Array<AR>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AR>): Array<AR>; (start: number, deleteCount?: number): Array<AR> };
with: (index: number, value: AR) => Array<AR>;
}
rightArray: import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) AR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AR> }
| { _tag: "PullRight"_tag: "PullRight"; leftArray: Arr.NonEmptyReadonlyArray<AL>(property) leftArray: {
0: AL;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AL>>): Array<AL>; (...items: Array<AL | ConcatArray<AL>>): Array<AL> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AL>;
indexOf: (searchElement: AL, fromIndex?: number) => number;
lastIndexOf: (searchElement: AL, fromIndex?: number) => number;
every: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): Array<AL> };
reduce: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
reduceRight: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
find: { (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findIndex: (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AL]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AL>;
includes: (searchElement: AL, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AL, index: number, array: Array<AL>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AL | undefined;
findLast: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findLastIndex: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AL>;
toSorted: (compareFn?: ((a: AL, b: AL) => number) | undefined) => Array<AL>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AL>): Array<AL>; (start: number, deleteCount?: number): Array<AL> };
with: (index: number, value: AL) => Array<AL>;
}
leftArray: import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) AL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>AL> }
let let state: Statestate: type State =
| {
_tag: "PullBoth"
}
| {
_tag: "PullLeft"
rightArray: Arr.NonEmptyReadonlyArray<AR>
}
| {
_tag: "PullRight"
leftArray: Arr.NonEmptyReadonlyArray<AL>
}
State = { _tag: "PullBoth"_tag: "PullBoth" }
const const pull: Effect.Effect<
Arr.NonEmptyReadonlyArray<A>,
EL | ER | Cause.Done,
RL | RR
>
const pull: {
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; <…;
toString: () => string;
toJSON: () => unknown;
}
pull: 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<
import ArrArr.type NonEmptyReadonlyArray<A> = readonly [
A,
...A[]
]
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation.
Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
NonEmptyReadonlyArray<function (type parameter) A in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>A>,
function (type parameter) EL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>EL | function (type parameter) ER in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>ER | import CauseCause.interface Done<A = void>A graceful completion signal for queues and streams.
When to use
Use to model normal producer completion through a stream or queue error
channel.
Details
Done indicates that a producer has finished normally — no more elements
will arrive. It is distinct from an error or interruption; it represents
successful completion. The optional value field can carry a final
leftover payload.
Example (Signaling queue completion)
import { Cause, Effect, Queue } from "effect"
const program = Effect.gen(function*() {
const queue = yield* Queue.bounded<number, Cause.Done>(10)
yield* Queue.offer(queue, 1)
yield* Queue.end(queue)
const result = yield* Effect.flip(Queue.take(queue))
console.log(Cause.isDone(result)) // true
})
Companion namespace for the Done interface.
Creates a Done signal with an optional value.
When to use
Use when you need to construct a low-level pull completion signal directly.
Done,
function (type parameter) RL in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RL | function (type parameter) RR in <AL, EL, RL, AR, ER, RR, A>(left: Stream<AL, EL, RL>, right: Stream<AR, ER, RR>, f: (left: Arr.NonEmptyReadonlyArray<AL>, right: Arr.NonEmptyReadonlyArray<AR>) => readonly [output: Arr.NonEmptyReadonlyArray<A>, leftoverLeft: ReadonlyArray<AL>, leftoverRight: ReadonlyArray<AR>]): Stream<A, EL | ER, RL | RR>RR
> = import EffectEffect.const gen: {
<Eff extends Effect<any, any, any>, AEff>(
f: () => Generator<Eff, AEff, never>
): Effect<
AEff,
[Eff] extends [never]
? never
: [Eff] extends [
Effect<infer _A, infer E, infer _R>
]
? E
: never,
[Eff] extends [never]
? never
: [Eff] extends [
Effect<infer _A, infer _E, infer R>
]
? R
: never
>
<Self, Eff extends Effect<any, any, any>, AEff>(
options: { readonly self: Self },
f: (this: Self) => Generator<Eff, AEff, never>
): Effect<
AEff,
[Eff] extends [never]
? never
: [Eff] extends [
Effect<infer _A, infer E, infer _R>
]
? E
: never,
[Eff] extends [never]
? never
: [Eff] extends [
Effect<infer _A, infer _E, infer R>
]
? R
: never
>
}
gen(function*() {
const [const left: readonly [AL, ...AL[]]const left: {
0: AL;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AL>>): Array<AL>; (...items: Array<AL | ConcatArray<AL>>): Array<AL> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AL>;
indexOf: (searchElement: AL, fromIndex?: number) => number;
lastIndexOf: (searchElement: AL, fromIndex?: number) => number;
every: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): Array<AL> };
reduce: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
reduceRight: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
find: { (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findIndex: (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AL]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AL>;
includes: (searchElement: AL, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AL, index: number, array: Array<AL>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AL | undefined;
findLast: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findLastIndex: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AL>;
toSorted: (compareFn?: ((a: AL, b: AL) => number) | undefined) => Array<AL>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AL>): Array<AL>; (start: number, deleteCount?: number): Array<AL> };
with: (index: number, value: AL) => Array<AL>;
}
left, const right: readonly [AR, ...AR[]]const right: {
0: AR;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AR>>): Array<AR>; (...items: Array<AR | ConcatArray<AR>>): Array<AR> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AR>;
indexOf: (searchElement: AR, fromIndex?: number) => number;
lastIndexOf: (searchElement: AR, fromIndex?: number) => number;
every: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): Array<AR> };
reduce: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
reduceRight: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
find: { (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findIndex: (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AR]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AR>;
includes: (searchElement: AR, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AR, index: number, array: Array<AR>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AR | undefined;
findLast: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findLastIndex: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AR>;
toSorted: (compareFn?: ((a: AR, b: AR) => number) | undefined) => Array<AR>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AR>): Array<AR>; (start: number, deleteCount?: number): Array<AR> };
with: (index: number, value: AR) => Array<AR>;
}
right] = let state: Statestate._tag: "PullBoth" | "PullLeft" | "PullRight"_tag === "PullBoth"
? yield* const pullBoth: Effect.Effect<
[
readonly [AL, ...AL[]],
readonly [AR, ...AR[]]
],
never,
RL | RR
>
const pullBoth: {
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; <…;
toString: () => string;
toJSON: () => unknown;
}
pullBoth
: let state:
| {
_tag: "PullLeft"
rightArray: Arr.NonEmptyReadonlyArray<AR>
}
| {
_tag: "PullRight"
leftArray: Arr.NonEmptyReadonlyArray<AL>
}
state._tag: "PullLeft" | "PullRight"_tag === "PullLeft"
? [yield* const pullLeft: Pull.Pull<
readonly [AL, ...AL[]],
EL,
void,
RL
>
const pullLeft: {
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; <…;
toString: () => string;
toJSON: () => unknown;
}
pullLeft, let state: {
_tag: "PullLeft"
rightArray: Arr.NonEmptyReadonlyArray<AR>
}
state.rightArray: Arr.NonEmptyReadonlyArray<AR>(property) rightArray: {
0: AR;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AR>>): Array<AR>; (...items: Array<AR | ConcatArray<AR>>): Array<AR> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AR>;
indexOf: (searchElement: AR, fromIndex?: number) => number;
lastIndexOf: (searchElement: AR, fromIndex?: number) => number;
every: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): Array<AR> };
reduce: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
reduceRight: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
find: { (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findIndex: (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AR]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AR>;
includes: (searchElement: AR, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AR, index: number, array: Array<AR>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AR | undefined;
findLast: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findLastIndex: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AR>;
toSorted: (compareFn?: ((a: AR, b: AR) => number) | undefined) => Array<AR>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AR>): Array<AR>; (start: number, deleteCount?: number): Array<AR> };
with: (index: number, value: AR) => Array<AR>;
}
rightArray]
: [let state: {
_tag: "PullRight"
leftArray: Arr.NonEmptyReadonlyArray<AL>
}
state.leftArray: Arr.NonEmptyReadonlyArray<AL>(property) leftArray: {
0: AL;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AL>>): Array<AL>; (...items: Array<AL | ConcatArray<AL>>): Array<AL> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AL>;
indexOf: (searchElement: AL, fromIndex?: number) => number;
lastIndexOf: (searchElement: AL, fromIndex?: number) => number;
every: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): Array<AL> };
reduce: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
reduceRight: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
find: { (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findIndex: (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AL]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AL>;
includes: (searchElement: AL, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AL, index: number, array: Array<AL>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AL | undefined;
findLast: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findLastIndex: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AL>;
toSorted: (compareFn?: ((a: AL, b: AL) => number) | undefined) => Array<AL>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AL>): Array<AL>; (start: number, deleteCount?: number): Array<AL> };
with: (index: number, value: AL) => Array<AL>;
}
leftArray, yield* const pullRight: Pull.Pull<
readonly [AR, ...AR[]],
ER,
void,
RR
>
const pullRight: {
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; <…;
toString: () => string;
toJSON: () => unknown;
}
pullRight]
const const result: readonly [
output: readonly [A, ...A[]],
leftoverLeft: readonly AL[],
leftoverRight: readonly AR[]
]
const result: {
0: readonly [A, ...A[]];
1: ReadonlyArray<AL>;
2: ReadonlyArray<AR>;
length: 3;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>>): Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>; (...items: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A…;
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
indexOf: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => number;
lastIndexOf: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => number;
every: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): this is readonly S[]; (pr…;
some: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => void, thisArg?: any) => void;
map: (callbackfn: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): Array<S>; (predicate: (va…;
reduce: { (callbackfn: (previousValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentIndex: number, array: ReadonlyArray<ReadonlyArray<AL> | Readonl…;
reduceRight: { (callbackfn: (previousValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentIndex: number, array: ReadonlyArray<ReadonlyArray<AL> | Readonl…;
find: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, obj: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): S | undefined; (predicate: …;
findIndex: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, obj: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
includes: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => U | ReadonlyArray<U>, thisArg?: This | undefined) =>…;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]] | undefined;
findLast: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): S | undefined; (predicate…;
findLastIndex: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => number;
toReversed: () => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
toSorted: (compareFn?: ((a: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], b: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]) => number) | undefined) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>): Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>; (start: number, deleteCount?: number): Array<Readon…;
with: (index: number, value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
}
result = f: (
left: Arr.NonEmptyReadonlyArray<AL>,
right: Arr.NonEmptyReadonlyArray<AR>
) => readonly [
output: Arr.NonEmptyReadonlyArray<A>,
leftoverLeft: ReadonlyArray<AL>,
leftoverRight: ReadonlyArray<AR>
]
f(const left: readonly [AL, ...AL[]]const left: {
0: AL;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AL>>): Array<AL>; (...items: Array<AL | ConcatArray<AL>>): Array<AL> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AL>;
indexOf: (searchElement: AL, fromIndex?: number) => number;
lastIndexOf: (searchElement: AL, fromIndex?: number) => number;
every: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): Array<AL> };
reduce: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
reduceRight: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
find: { (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findIndex: (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AL]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AL>;
includes: (searchElement: AL, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AL, index: number, array: Array<AL>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AL | undefined;
findLast: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findLastIndex: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AL>;
toSorted: (compareFn?: ((a: AL, b: AL) => number) | undefined) => Array<AL>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AL>): Array<AL>; (start: number, deleteCount?: number): Array<AL> };
with: (index: number, value: AL) => Array<AL>;
}
left, const right: readonly [AR, ...AR[]]const right: {
0: AR;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AR>>): Array<AR>; (...items: Array<AR | ConcatArray<AR>>): Array<AR> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AR>;
indexOf: (searchElement: AR, fromIndex?: number) => number;
lastIndexOf: (searchElement: AR, fromIndex?: number) => number;
every: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): Array<AR> };
reduce: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
reduceRight: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
find: { (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findIndex: (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AR]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AR>;
includes: (searchElement: AR, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AR, index: number, array: Array<AR>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AR | undefined;
findLast: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findLastIndex: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AR>;
toSorted: (compareFn?: ((a: AR, b: AR) => number) | undefined) => Array<AR>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AR>): Array<AR>; (start: number, deleteCount?: number): Array<AR> };
with: (index: number, value: AR) => Array<AR>;
}
right)
if (import ArrArr.const isReadonlyArrayNonEmpty: <A>(
self: ReadonlyArray<A>
) => self is NonEmptyReadonlyArray<A>
Checks whether a ReadonlyArray is non-empty, narrowing the type to
NonEmptyReadonlyArray.
When to use
Use when you need to prove a readonly array has at least one element without
requiring mutable array methods afterward.
Example (Checking for a non-empty readonly array)
import { Array } from "effect"
console.log(Array.isReadonlyArrayNonEmpty([])) // false
console.log(Array.isReadonlyArrayNonEmpty([1, 2, 3])) // true
isReadonlyArrayNonEmpty(const result: readonly [
output: readonly [A, ...A[]],
leftoverLeft: readonly AL[],
leftoverRight: readonly AR[]
]
const result: {
0: readonly [A, ...A[]];
1: ReadonlyArray<AL>;
2: ReadonlyArray<AR>;
length: 3;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>>): Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>; (...items: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A…;
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
indexOf: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => number;
lastIndexOf: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => number;
every: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): this is readonly S[]; (pr…;
some: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => void, thisArg?: any) => void;
map: (callbackfn: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): Array<S>; (predicate: (va…;
reduce: { (callbackfn: (previousValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentIndex: number, array: ReadonlyArray<ReadonlyArray<AL> | Readonl…;
reduceRight: { (callbackfn: (previousValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentIndex: number, array: ReadonlyArray<ReadonlyArray<AL> | Readonl…;
find: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, obj: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): S | undefined; (predicate: …;
findIndex: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, obj: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
includes: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => U | ReadonlyArray<U>, thisArg?: This | undefined) =>…;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]] | undefined;
findLast: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): S | undefined; (predicate…;
findLastIndex: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => number;
toReversed: () => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
toSorted: (compareFn?: ((a: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], b: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]) => number) | undefined) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>): Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>; (start: number, deleteCount?: number): Array<Readon…;
with: (index: number, value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
}
result[1])) {
let state: Statestate = { _tag: "PullRight"_tag: "PullRight", leftArray: readonly [AL, ...AL[]](property) leftArray: {
0: AL;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AL>>): Array<AL>; (...items: Array<AL | ConcatArray<AL>>): Array<AL> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AL>;
indexOf: (searchElement: AL, fromIndex?: number) => number;
lastIndexOf: (searchElement: AL, fromIndex?: number) => number;
every: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AL, index: number, array: ReadonlyArray<AL>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): Array<AL> };
reduce: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
reduceRight: { (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL): AL; (callbackfn: (previousValue: AL, currentValue: AL, currentIndex: number, array: ReadonlyArray<AL>) => AL, initialValue: AL): A…;
find: { (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findIndex: (predicate: (value: AL, index: number, obj: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AL]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AL>;
includes: (searchElement: AL, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AL, index: number, array: Array<AL>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AL | undefined;
findLast: { (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any): AL | undefined };
findLastIndex: (predicate: (value: AL, index: number, array: ReadonlyArray<AL>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AL>;
toSorted: (compareFn?: ((a: AL, b: AL) => number) | undefined) => Array<AL>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AL>): Array<AL>; (start: number, deleteCount?: number): Array<AL> };
with: (index: number, value: AL) => Array<AL>;
}
leftArray: const result: readonly [
output: readonly [A, ...A[]],
leftoverLeft: readonly AL[],
leftoverRight: readonly AR[]
]
const result: {
0: readonly [A, ...A[]];
1: ReadonlyArray<AL>;
2: ReadonlyArray<AR>;
length: 3;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>>): Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>; (...items: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A…;
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
indexOf: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => number;
lastIndexOf: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => number;
every: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): this is readonly S[]; (pr…;
some: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => void, thisArg?: any) => void;
map: (callbackfn: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): Array<S>; (predicate: (va…;
reduce: { (callbackfn: (previousValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentIndex: number, array: ReadonlyArray<ReadonlyArray<AL> | Readonl…;
reduceRight: { (callbackfn: (previousValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentIndex: number, array: ReadonlyArray<ReadonlyArray<AL> | Readonl…;
find: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, obj: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): S | undefined; (predicate: …;
findIndex: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, obj: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
includes: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => U | ReadonlyArray<U>, thisArg?: This | undefined) =>…;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]] | undefined;
findLast: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): S | undefined; (predicate…;
findLastIndex: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => number;
toReversed: () => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
toSorted: (compareFn?: ((a: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], b: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]) => number) | undefined) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>): Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>; (start: number, deleteCount?: number): Array<Readon…;
with: (index: number, value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
}
result[1] }
} else if (import ArrArr.const isReadonlyArrayNonEmpty: <A>(
self: ReadonlyArray<A>
) => self is NonEmptyReadonlyArray<A>
Checks whether a ReadonlyArray is non-empty, narrowing the type to
NonEmptyReadonlyArray.
When to use
Use when you need to prove a readonly array has at least one element without
requiring mutable array methods afterward.
Example (Checking for a non-empty readonly array)
import { Array } from "effect"
console.log(Array.isReadonlyArrayNonEmpty([])) // false
console.log(Array.isReadonlyArrayNonEmpty([1, 2, 3])) // true
isReadonlyArrayNonEmpty(const result: readonly [
output: readonly [A, ...A[]],
leftoverLeft: readonly AL[],
leftoverRight: readonly AR[]
]
const result: {
0: readonly [A, ...A[]];
1: ReadonlyArray<AL>;
2: ReadonlyArray<AR>;
length: 3;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>>): Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>; (...items: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A…;
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
indexOf: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => number;
lastIndexOf: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => number;
every: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): this is readonly S[]; (pr…;
some: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => void, thisArg?: any) => void;
map: (callbackfn: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): Array<S>; (predicate: (va…;
reduce: { (callbackfn: (previousValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentIndex: number, array: ReadonlyArray<ReadonlyArray<AL> | Readonl…;
reduceRight: { (callbackfn: (previousValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentIndex: number, array: ReadonlyArray<ReadonlyArray<AL> | Readonl…;
find: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, obj: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): S | undefined; (predicate: …;
findIndex: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, obj: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
includes: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => U | ReadonlyArray<U>, thisArg?: This | undefined) =>…;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]] | undefined;
findLast: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): S | undefined; (predicate…;
findLastIndex: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => number;
toReversed: () => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
toSorted: (compareFn?: ((a: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], b: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]) => number) | undefined) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>): Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>; (start: number, deleteCount?: number): Array<Readon…;
with: (index: number, value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
}
result[2])) {
let state: Statestate = { _tag: "PullLeft"_tag: "PullLeft", rightArray: readonly [AR, ...AR[]](property) rightArray: {
0: AR;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<AR>>): Array<AR>; (...items: Array<AR | ConcatArray<AR>>): Array<AR> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<AR>;
indexOf: (searchElement: AR, fromIndex?: number) => number;
lastIndexOf: (searchElement: AR, fromIndex?: number) => number;
every: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => void, thisArg?: any) => void;
map: (callbackfn: (value: AR, index: number, array: ReadonlyArray<AR>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): Array<S>; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): Array<AR> };
reduce: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
reduceRight: { (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR): AR; (callbackfn: (previousValue: AR, currentValue: AR, currentIndex: number, array: ReadonlyArray<AR>) => AR, initialValue: AR): A…;
find: { (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findIndex: (predicate: (value: AR, index: number, obj: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, AR]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<AR>;
includes: (searchElement: AR, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: AR, index: number, array: Array<AR>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => AR | undefined;
findLast: { (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => value is S, thisArg?: any): S | undefined; (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any): AR | undefined };
findLastIndex: (predicate: (value: AR, index: number, array: ReadonlyArray<AR>) => unknown, thisArg?: any) => number;
toReversed: () => Array<AR>;
toSorted: (compareFn?: ((a: AR, b: AR) => number) | undefined) => Array<AR>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<AR>): Array<AR>; (start: number, deleteCount?: number): Array<AR> };
with: (index: number, value: AR) => Array<AR>;
}
rightArray: const result: readonly [
output: readonly [A, ...A[]],
leftoverLeft: readonly AL[],
leftoverRight: readonly AR[]
]
const result: {
0: readonly [A, ...A[]];
1: ReadonlyArray<AL>;
2: ReadonlyArray<AR>;
length: 3;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>>): Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>; (...items: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A…;
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
indexOf: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => number;
lastIndexOf: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => number;
every: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): this is readonly S[]; (pr…;
some: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => void, thisArg?: any) => void;
map: (callbackfn: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): Array<S>; (predicate: (va…;
reduce: { (callbackfn: (previousValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentIndex: number, array: ReadonlyArray<ReadonlyArray<AL> | Readonl…;
reduceRight: { (callbackfn: (previousValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentIndex: number, array: ReadonlyArray<ReadonlyArray<AL> | Readonl…;
find: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, obj: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): S | undefined; (predicate: …;
findIndex: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, obj: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
includes: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => U | ReadonlyArray<U>, thisArg?: This | undefined) =>…;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]] | undefined;
findLast: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): S | undefined; (predicate…;
findLastIndex: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => number;
toReversed: () => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
toSorted: (compareFn?: ((a: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], b: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]) => number) | undefined) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>): Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>; (start: number, deleteCount?: number): Array<Readon…;
with: (index: number, value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
}
result[2] }
} else {
let state: Statestate = { _tag: "PullBoth"_tag: "PullBoth" }
}
return const result: readonly [
output: readonly [A, ...A[]],
leftoverLeft: readonly AL[],
leftoverRight: readonly AR[]
]
const result: {
0: readonly [A, ...A[]];
1: ReadonlyArray<AL>;
2: ReadonlyArray<AR>;
length: 3;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>>): Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>; (...items: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A…;
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
indexOf: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => number;
lastIndexOf: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => number;
every: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): this is readonly S[]; (pr…;
some: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => void, thisArg?: any) => void;
map: (callbackfn: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): Array<S>; (predicate: (va…;
reduce: { (callbackfn: (previousValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentIndex: number, array: ReadonlyArray<ReadonlyArray<AL> | Readonl…;
reduceRight: { (callbackfn: (previousValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentValue: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], currentIndex: number, array: ReadonlyArray<ReadonlyArray<AL> | Readonl…;
find: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, obj: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): S | undefined; (predicate: …;
findIndex: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, obj: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
includes: (searchElement: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => U | ReadonlyArray<U>, thisArg?: This | undefined) =>…;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]] | undefined;
findLast: { (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => value is S, thisArg?: any): S | undefined; (predicate…;
findLastIndex: (predicate: (value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], index: number, array: ReadonlyArray<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>) => unknown, thisArg?: any) => number;
toReversed: () => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
toSorted: (compareFn?: ((a: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]], b: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]) => number) | undefined) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>): Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>; (start: number, deleteCount?: number): Array<Readon…;
with: (index: number, value: ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]) => Array<ReadonlyArray<AL> | ReadonlyArray<AR> | readonly [A, ...A[]]>;
}
result[0]
})
return const pull: Effect.Effect<
Arr.NonEmptyReadonlyArray<A>,
EL | ER | Cause.Done,
RL | RR
>
const pull: {
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; <…;
toString: () => string;
toJSON: () => unknown;
}
pull
}))))