(options?: {
readonly disableErrorReporting?: boolean | undefined
readonly teardown?: Runtime.Teardown | undefined
}): <E, A>(effect: Effect<A, E>) => void
<E, A>(
effect: Effect<A, E>,
options?: {
readonly disableErrorReporting?: boolean | undefined
readonly teardown?: Runtime.Teardown | undefined
}
): voidHelps you run a main effect with built-in error handling, logging, and signal management.
When to use
Use to run a Node.js application's main Effect with structured error handling, log management, interrupt support, or advanced teardown capabilities.
Details
This function launches an Effect as the main entry point, setting exit codes based on success or failure, handling interrupts (e.g., Ctrl+C), and optionally logging errors. By default, it logs errors and uses a "pretty" format, but both behaviors can be turned off. You can also provide custom teardown logic to finalize resources or produce different exit codes.
The optional configuration object can include:
disableErrorReporting: Turn off automatic error logging.teardown: Provide custom finalization logic.
export const const runMain: {
(options?: {
readonly disableErrorReporting?:
| boolean
| undefined
readonly teardown?:
| Runtime.Teardown
| undefined
}): <E, A>(effect: Effect<A, E>) => void
<E, A>(
effect: Effect<A, E>,
options?: {
readonly disableErrorReporting?:
| boolean
| undefined
readonly teardown?:
| Runtime.Teardown
| undefined
}
): void
}
Helps you run a main effect with built-in error handling, logging, and signal management.
When to use
Use to run a Node.js application's main Effect with structured error
handling, log management, interrupt support, or advanced teardown
capabilities.
Details
This function launches an Effect as the main entry point, setting exit codes
based on success or failure, handling interrupts (e.g., Ctrl+C), and optionally
logging errors. By default, it logs errors and uses a "pretty" format, but both
behaviors can be turned off. You can also provide custom teardown logic to
finalize resources or produce different exit codes.
The optional configuration object can include:
disableErrorReporting: Turn off automatic error logging.
teardown: Provide custom finalization logic.
runMain: {
(
options: {
readonly disableErrorReporting?:
| boolean
| undefined
readonly teardown?: Runtime.Teardown | undefined
}
options?: {
readonly disableErrorReporting?: boolean | undefineddisableErrorReporting?: boolean | undefined
readonly teardown?: Runtime.Teardown | undefinedteardown?: import RuntimeRuntime.Teardown | undefined
}
): <function (type parameter) E in <E, A>(effect: Effect<A, E>): voidE, function (type parameter) A in <E, A>(effect: Effect<A, E>): voidA>(effect: Effect<A, E>(parameter) effect: {
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;
}
effect: 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<function (type parameter) A in <E, A>(effect: Effect<A, E>): voidA, function (type parameter) E in <E, A>(effect: Effect<A, E>): voidE>) => void
<function (type parameter) E in <E, A>(effect: Effect<A, E>, options?: {
readonly disableErrorReporting?: boolean | undefined;
readonly teardown?: Runtime.Teardown | undefined;
}): void
E, function (type parameter) A in <E, A>(effect: Effect<A, E>, options?: {
readonly disableErrorReporting?: boolean | undefined;
readonly teardown?: Runtime.Teardown | undefined;
}): void
A>(
effect: Effect<A, E>(parameter) effect: {
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;
}
effect: 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<function (type parameter) A in <E, A>(effect: Effect<A, E>, options?: {
readonly disableErrorReporting?: boolean | undefined;
readonly teardown?: Runtime.Teardown | undefined;
}): void
A, function (type parameter) E in <E, A>(effect: Effect<A, E>, options?: {
readonly disableErrorReporting?: boolean | undefined;
readonly teardown?: Runtime.Teardown | undefined;
}): void
E>,
options: {
readonly disableErrorReporting?:
| boolean
| undefined
readonly teardown?: Runtime.Teardown | undefined
}
options?: {
readonly disableErrorReporting?: boolean | undefineddisableErrorReporting?: boolean | undefined
readonly teardown?: Runtime.Teardown | undefinedteardown?: import RuntimeRuntime.Teardown | undefined
}
): void
} = import NodeRuntimeNodeRuntime.runMain