<S extends Schema.Constraint>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: S["Type"],
options?: SchemaAST.ParseOptions
) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]>Creates an effectful encoder for input already typed as the schema's decoded
Type.
When to use
Use when you need to encode values already typed as the schema's decoded
Type in an Effect whose failure channel is SchemaIssue.Issue, while
preserving service requirements.
Details
The returned function succeeds with the schema's Encoded value or fails with a
SchemaIssue.Issue, preserving any encoding service requirements in the
returned Effect.
export const const encodeEffect: <
S extends Schema.Constraint
>(
schema: S,
options?: SchemaAST.ParseOptions
) => (
input: S["Type"],
options?: SchemaAST.ParseOptions
) => Effect.Effect<
S["Encoded"],
SchemaIssue.Issue,
S["EncodingServices"]
>
Creates an effectful encoder for input already typed as the schema's decoded
Type.
When to use
Use when you need to encode values already typed as the schema's decoded
Type in an Effect whose failure channel is SchemaIssue.Issue, while
preserving service requirements.
Details
The returned function succeeds with the schema's Encoded value or fails with a
SchemaIssue.Issue, preserving any encoding service requirements in the
returned Effect.
encodeEffect: <function (type parameter) S in <S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]>S extends import SchemaSchema.Constraint>(
schema: S extends Schema.Constraintschema: function (type parameter) S in <S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]>S,
options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.ParseOptions
) => (
input: S["Type"]input: function (type parameter) S in <S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]>S["Type"],
options: SchemaAST.ParseOptionsoptions?: import SchemaASTSchemaAST.ParseOptions
) => 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<function (type parameter) S in <S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]>S["Encoded"], import SchemaIssueSchemaIssue.type Issue =
| SchemaIssue.Leaf
| SchemaIssue.Filter
| SchemaIssue.Encoding
| SchemaIssue.Pointer
| SchemaIssue.Composite
| SchemaIssue.AnyOf
The root discriminated union of all validation error nodes.
When to use
Use when typing the error channel in Effect<A, Issue, R> results from
schema parsing, or when writing custom formatters or issue-tree walkers.
Details
Every node has a _tag field for pattern-matching. The union includes both
terminal
Leaf
types and composite types that wrap inner issues:
Filter
,
Encoding
,
Pointer
,
Composite
,
AnyOf
. All Issue instances have a toString() that delegates to
the default formatter, so String(issue) produces a human-readable message.
Issue, function (type parameter) S in <S extends Schema.Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]>S["EncodingServices"]> = function encodeUnknownEffect<
S extends Schema.Constraint
>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: unknown,
options?: SchemaAST.ParseOptions
) => Effect.Effect<
S["Encoded"],
SchemaIssue.Issue,
S["EncodingServices"]
>
Creates an effectful encoder for unknown input.
When to use
Use when you need to encode untyped boundary input in an Effect whose
failure channel is SchemaIssue.Issue, while preserving service
requirements.
Details
The returned function succeeds with the schema's Encoded value or fails with a
SchemaIssue.Issue. Encoding service requirements are preserved in the returned
Effect. Parse options may be provided when creating the encoder and overridden
when applying it.
encodeUnknownEffect