<A2, A3, A4>(options: {
readonly start: A2
readonly middle: A3
readonly end: A4
}): <A, E, R>(self: Stream<A, E, R>) => Stream<A2 | A3 | A4 | A, E, R>
<A, E, R, A2, A3, A4>(
self: Stream<A, E, R>,
options: { readonly start: A2; readonly middle: A3; readonly end: A4 }
): Stream<A | A2 | A3 | A4, E, R>Adds a start value, middle value, and end value around stream elements.
Details
The start and end values are always emitted, even when the stream is empty.
Example (Interspersing stream affixes)
import { Console, Effect, Stream } from "effect"
const stream = Stream.make("a", "b", "c").pipe(
Stream.intersperseAffixes({ start: "[", middle: ",", end: "]" })
)
const program = Effect.gen(function*() {
const result = yield* Stream.runCollect(stream)
yield* Console.log(result)
})
Effect.runPromise(program)
// [ "[", "a", ",", "b", ",", "c", "]" ]export const const intersperseAffixes: {
<A2, A3, A4>(options: {
readonly start: A2
readonly middle: A3
readonly end: A4
}): <A, E, R>(
self: Stream<A, E, R>
) => Stream<A2 | A3 | A4 | A, E, R>
<A, E, R, A2, A3, A4>(
self: Stream<A, E, R>,
options: {
readonly start: A2
readonly middle: A3
readonly end: A4
}
): Stream<A | A2 | A3 | A4, E, R>
}
Adds a start value, middle value, and end value around stream elements.
Details
The start and end values are always emitted, even when the stream is empty.
Example (Interspersing stream affixes)
import { Console, Effect, Stream } from "effect"
const stream = Stream.make("a", "b", "c").pipe(
Stream.intersperseAffixes({ start: "[", middle: ",", end: "]" })
)
const program = Effect.gen(function*() {
const result = yield* Stream.runCollect(stream)
yield* Console.log(result)
})
Effect.runPromise(program)
// [ "[", "a", ",", "b", ",", "c", "]" ]
intersperseAffixes: {
<function (type parameter) A2 in <A2, A3, A4>(options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): <A, E, R>(self: Stream<A, E, R>) => Stream<A2 | A3 | A4 | A, E, R>
A2, function (type parameter) A3 in <A2, A3, A4>(options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): <A, E, R>(self: Stream<A, E, R>) => Stream<A2 | A3 | A4 | A, E, R>
A3, function (type parameter) A4 in <A2, A3, A4>(options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): <A, E, R>(self: Stream<A, E, R>) => Stream<A2 | A3 | A4 | A, E, R>
A4>(
options: {
readonly start: A2
readonly middle: A3
readonly end: A4
}
options: { readonly start: A2start: function (type parameter) A2 in <A2, A3, A4>(options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): <A, E, R>(self: Stream<A, E, R>) => Stream<A2 | A3 | A4 | A, E, R>
A2; readonly middle: A3middle: function (type parameter) A3 in <A2, A3, A4>(options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): <A, E, R>(self: Stream<A, E, R>) => Stream<A2 | A3 | A4 | A, E, R>
A3; readonly end: A4end: function (type parameter) A4 in <A2, A3, A4>(options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): <A, E, R>(self: Stream<A, E, R>) => Stream<A2 | A3 | A4 | A, E, R>
A4 }
): <function (type parameter) A in <A, E, R>(self: Stream<A, E, R>): Stream<A2 | A3 | A4 | A, E, R>A, function (type parameter) E in <A, E, R>(self: Stream<A, E, R>): Stream<A2 | A3 | A4 | A, E, R>E, function (type parameter) R in <A, E, R>(self: Stream<A, E, R>): Stream<A2 | A3 | A4 | A, E, R>R>(self: Stream<A, E, R>(parameter) self: {
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; <…;
}
self: 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 <A, E, R>(self: Stream<A, E, R>): Stream<A2 | A3 | A4 | A, E, R>A, function (type parameter) E in <A, E, R>(self: Stream<A, E, R>): Stream<A2 | A3 | A4 | A, E, R>E, function (type parameter) R in <A, E, R>(self: Stream<A, E, R>): Stream<A2 | A3 | A4 | A, E, R>R>) => 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) A2 in <A2, A3, A4>(options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): <A, E, R>(self: Stream<A, E, R>) => Stream<A2 | A3 | A4 | A, E, R>
A2 | function (type parameter) A3 in <A2, A3, A4>(options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): <A, E, R>(self: Stream<A, E, R>) => Stream<A2 | A3 | A4 | A, E, R>
A3 | function (type parameter) A4 in <A2, A3, A4>(options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): <A, E, R>(self: Stream<A, E, R>) => Stream<A2 | A3 | A4 | A, E, R>
A4 | function (type parameter) A in <A, E, R>(self: Stream<A, E, R>): Stream<A2 | A3 | A4 | A, E, R>A, function (type parameter) E in <A, E, R>(self: Stream<A, E, R>): Stream<A2 | A3 | A4 | A, E, R>E, function (type parameter) R in <A, E, R>(self: Stream<A, E, R>): Stream<A2 | A3 | A4 | A, E, R>R>
<function (type parameter) A in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A, function (type parameter) E in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
E, function (type parameter) R in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
R, function (type parameter) A2 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A2, function (type parameter) A3 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A3, function (type parameter) A4 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A4>(
self: Stream<A, E, R>(parameter) self: {
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; <…;
}
self: 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 <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A, function (type parameter) E in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
E, function (type parameter) R in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
R>,
options: {
readonly start: A2
readonly middle: A3
readonly end: A4
}
options: { readonly start: A2start: function (type parameter) A2 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A2; readonly middle: A3middle: function (type parameter) A3 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A3; readonly end: A4end: function (type parameter) A4 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A4 }
): 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 <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A | function (type parameter) A2 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A2 | function (type parameter) A3 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A3 | function (type parameter) A4 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A4, function (type parameter) E in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
E, function (type parameter) R in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
R>
} = dual<(...args: Array<any>) => any, <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}) => Stream<A | A2 | A3 | A4, E, R>>(arity: 2, body: <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}) => Stream<A | A2 | A3 | A4, E, R>): ((...args: Array<any>) => any) & (<A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}) => Stream<A | A2 | A3 | A4, E, R>) (+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(2, <function (type parameter) A in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A, function (type parameter) E in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
E, function (type parameter) R in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
R, function (type parameter) A2 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A2, function (type parameter) A3 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A3, function (type parameter) A4 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A4>(
self: Stream<A, E, R>(parameter) self: {
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; <…;
}
self: 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 <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A, function (type parameter) E in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
E, function (type parameter) R in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
R>,
options: {
readonly start: A2
readonly middle: A3
readonly end: A4
}
options: { readonly start: A2start: function (type parameter) A2 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A2; readonly middle: A3middle: function (type parameter) A3 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A3; readonly end: A4end: function (type parameter) A4 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A4 }
): 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 <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A | function (type parameter) A2 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A2 | function (type parameter) A3 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A3 | function (type parameter) A4 in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
A4, function (type parameter) E in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
E, function (type parameter) R in <A, E, R, A2, A3, A4>(self: Stream<A, E, R>, options: {
readonly start: A2;
readonly middle: A3;
readonly end: A4;
}): Stream<A | A2 | A3 | A4, E, R>
R> =>
const succeed: <A>(value: A) => Stream<A>Creates a single-valued pure stream.
Example (Creating a single-valued pure stream)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
const values = yield* Stream.succeed(3).pipe(Stream.runCollect)
yield* Console.log(values)
})
Effect.runPromise(program)
// [ 3 ]
succeed(options: {
readonly start: A2
readonly middle: A3
readonly end: A4
}
options.start: A2start).Pipeable.pipe<Stream<A2, never, never>, Stream<A | A2 | A3, E, R>, Stream<A | A2 | A3 | A4, E, R>>(this: Stream<A2, never, never>, ab: (_: Stream<A2, never, never>) => Stream<A | A2 | A3, E, R>, bc: (_: Stream<A | A2 | A3, E, R>) => Stream<A | A2 | A3 | A4, E, R>): Stream<A | A2 | A3 | A4, E, R> (+21 overloads)pipe(
const concat: {
<A2, E2, R2>(that: Stream<A2, E2, R2>): <
A,
E,
R
>(
self: Stream<A, E, R>
) => Stream<A | A2, E | E2, R | R2>
<A, E, R, A2, E2, R2>(
self: Stream<A, E, R>,
that: Stream<A2, E2, R2>
): Stream<A | A2, E | E2, R | R2>
}
concat(const intersperse: {
<A2>(element: A2): <A, E, R>(
self: Stream<A, E, R>
) => Stream<A2 | A, E, R>
<A, E, R, A2>(
self: Stream<A, E, R>,
element: A2
): Stream<A | A2, E, R>
}
intersperse(self: Stream<A, E, R>(parameter) self: {
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; <…;
}
self, options: {
readonly start: A2
readonly middle: A3
readonly end: A4
}
options.middle: A3middle)),
const concat: {
<A2, E2, R2>(that: Stream<A2, E2, R2>): <
A,
E,
R
>(
self: Stream<A, E, R>
) => Stream<A | A2, E | E2, R | R2>
<A, E, R, A2, E2, R2>(
self: Stream<A, E, R>,
that: Stream<A2, E2, R2>
): Stream<A | A2, E | E2, R | R2>
}
concat(const succeed: <A>(value: A) => Stream<A>Creates a single-valued pure stream.
Example (Creating a single-valued pure stream)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
const values = yield* Stream.succeed(3).pipe(Stream.runCollect)
yield* Console.log(values)
})
Effect.runPromise(program)
// [ 3 ]
succeed(options: {
readonly start: A2
readonly middle: A3
readonly end: A4
}
options.end: A4end))
))