<
Arg extends
| Effect<any, any, any>
| {
readonly log?: boolean | Severity | undefined
readonly message?: string | undefined
}
| undefined = {
readonly log?: boolean | Severity | undefined
readonly message?: string | undefined
}
>(
effectOrOptions?: Arg,
options?:
| {
readonly log?: boolean | Severity | undefined
readonly message?: string | undefined
}
| undefined
): [Arg] extends [Effect<infer _A, infer _E, infer _R>]
? Effect<void, never, _R>
: <A, E, R>(self: Effect<A, E, R>) => Effect<void, never, R>Discards both the success and failure values of an effect.
When to use
Use when an effect should run for its side effects while both success and failure values are discarded.
Details
Use the log option to emit the full Cause when the effect fails,
and message to prepend a custom log message.
Example (Discarding success and failure values)
import { Effect } from "effect"
// ┌─── Effect<number, string, never>
// ▼
const task = Effect.fail("Uh oh!").pipe(Effect.as(5))
// ┌─── Effect<void, never, never>
// ▼
const program = task.pipe(Effect.ignore)Example (Logging failures while ignoring results)
import { Effect } from "effect"
const task = Effect.fail("Uh oh!")
const program = task.pipe(Effect.ignore({ log: true }))
const programWarn = task.pipe(Effect.ignore({ log: "Warn", message: "Ignoring task failure" }))export const const ignore: <
Arg extends
| Effect<any, any, any>
| {
readonly log?:
| boolean
| Severity
| undefined
readonly message?: string | undefined
}
| undefined = {
readonly log?: boolean | Severity | undefined
readonly message?: string | undefined
}
>(
effectOrOptions?: Arg,
options?:
| {
readonly log?:
| boolean
| Severity
| undefined
readonly message?: string | undefined
}
| undefined
) => [Arg] extends [
Effect<infer _A, infer _E, infer _R>
]
? Effect<void, never, _R>
: <A, E, R>(
self: Effect<A, E, R>
) => Effect<void, never, R>
Discards both the success and failure values of an effect.
When to use
Use when an effect should run for its side effects while both success and
failure values are discarded.
Details
Use the log option to emit the full
Cause
when the effect fails,
and message to prepend a custom log message.
Example (Discarding success and failure values)
import { Effect } from "effect"
// ┌─── Effect<number, string, never>
// ▼
const task = Effect.fail("Uh oh!").pipe(Effect.as(5))
// ┌─── Effect<void, never, never>
// ▼
const program = task.pipe(Effect.ignore)
Example (Logging failures while ignoring results)
import { Effect } from "effect"
const task = Effect.fail("Uh oh!")
const program = task.pipe(Effect.ignore({ log: true }))
const programWarn = task.pipe(Effect.ignore({ log: "Warn", message: "Ignoring task failure" }))
ignore: <
function (type parameter) Arg in <Arg extends Effect<any, any, any> | {
readonly log?: boolean | Severity | undefined;
readonly message?: string | undefined;
} | undefined = {
readonly log?: boolean | Severity | undefined;
readonly message?: string | undefined;
}>(effectOrOptions?: Arg, options?: {
readonly log?: boolean | Severity | undefined;
readonly message?: string | undefined;
} | undefined): [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Effect<void, never, _R> : <A, E, R>(self: Effect<A, E, R>) => Effect<void, never, R>
Arg extends 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<any, any, any> | {
readonly log?: boolean | Severity | undefinedlog?: boolean | type Severity = "Fatal" | "Error" | "Warn" | "Info" | "Debug" | "Trace"Log levels that represent actual message severities, excluding the All and
None sentinel levels.
When to use
Use when typing emitted log message severities, such as explicit log calls,
current log level references, or error-report severity annotations, where
All and None are not valid values.
Severity | undefined
readonly message?: string | undefinedmessage?: string | undefined
} | undefined = {
readonly log?: boolean | Severity | undefinedlog?: boolean | type Severity = "Fatal" | "Error" | "Warn" | "Info" | "Debug" | "Trace"Log levels that represent actual message severities, excluding the All and
None sentinel levels.
When to use
Use when typing emitted log message severities, such as explicit log calls,
current log level references, or error-report severity annotations, where
All and None are not valid values.
Severity | undefined
readonly message?: string | undefinedmessage?: string | undefined
}
>(
effectOrOptions: Arg | undefinedeffectOrOptions?: function (type parameter) Arg in <Arg extends Effect<any, any, any> | {
readonly log?: boolean | Severity | undefined;
readonly message?: string | undefined;
} | undefined = {
readonly log?: boolean | Severity | undefined;
readonly message?: string | undefined;
}>(effectOrOptions?: Arg, options?: {
readonly log?: boolean | Severity | undefined;
readonly message?: string | undefined;
} | undefined): [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Effect<void, never, _R> : <A, E, R>(self: Effect<A, E, R>) => Effect<void, never, R>
Arg,
options: | {
readonly log?:
| boolean
| Severity
| undefined
readonly message?: string | undefined
}
| undefined
options?: {
readonly log?: boolean | Severity | undefinedlog?: boolean | type Severity = "Fatal" | "Error" | "Warn" | "Info" | "Debug" | "Trace"Log levels that represent actual message severities, excluding the All and
None sentinel levels.
When to use
Use when typing emitted log message severities, such as explicit log calls,
current log level references, or error-report severity annotations, where
All and None are not valid values.
Severity | undefined
readonly message?: string | undefinedmessage?: string | undefined
} | undefined
) => [function (type parameter) Arg in <Arg extends Effect<any, any, any> | {
readonly log?: boolean | Severity | undefined;
readonly message?: string | undefined;
} | undefined = {
readonly log?: boolean | Severity | undefined;
readonly message?: string | undefined;
}>(effectOrOptions?: Arg, options?: {
readonly log?: boolean | Severity | undefined;
readonly message?: string | undefined;
} | undefined): [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Effect<void, never, _R> : <A, E, R>(self: Effect<A, E, R>) => Effect<void, never, R>
Arg] extends [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<infer function (type parameter) _A_A, infer function (type parameter) _E_E, infer function (type parameter) _R_R>] ? 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<void, never, function (type parameter) _R_R>
: <function (type parameter) A in <A, E, R>(self: Effect<A, E, R>): Effect<void, never, R>A, function (type parameter) E in <A, E, R>(self: Effect<A, E, R>): Effect<void, never, R>E, function (type parameter) R in <A, E, R>(self: Effect<A, E, R>): Effect<void, never, R>R>(self: Effect<A, E, R>(parameter) self: {
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;
}
self: 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 <A, E, R>(self: Effect<A, E, R>): Effect<void, never, R>A, function (type parameter) E in <A, E, R>(self: Effect<A, E, R>): Effect<void, never, R>E, function (type parameter) R in <A, E, R>(self: Effect<A, E, R>): Effect<void, never, R>R>) => 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<void, never, function (type parameter) R in <A, E, R>(self: Effect<A, E, R>): Effect<void, never, R>R> = import internalinternal.const ignore: <
Arg extends
| Effect.Effect<any, any, any>
| {
readonly log?:
| boolean
| LogLevel.Severity
| undefined
readonly message?: string | undefined
}
| undefined = {
readonly log?:
| boolean
| LogLevel.Severity
| undefined
readonly message?: string | undefined
}
>(
effectOrOptions: Arg,
options?:
| {
readonly log?:
| boolean
| LogLevel.Severity
| undefined
readonly message?: string | undefined
}
| undefined
) => [Arg] extends [
Effect.Effect<infer _A, infer _E, infer _R>
]
? Effect.Effect<void, never, _R>
: <A, E, R>(
self: Effect.Effect<A, E, R>
) => Effect.Effect<void, never, R>
ignore