Optic<T, Iso>A schema that additionally supports optic (lens/prism) operations.
Details
Optic<T, Iso> extends Schema<T> with an Iso type that
describes the isomorphic counterpart used by the optic layer. Crucially,
decoding and encoding require no Effect services (DecodingServices and
EncodingServices are both never), which means the optic can operate
purely without an Effect runtime.
Most primitive schemas (e.g. Schema.String, Schema.Number) implement
Optic automatically. You normally interact with this interface through
Optic_ utilities rather than constructing it directly.
export interface interface Optic<out T, out Iso>A schema that additionally supports optic (lens/prism) operations.
Details
Optic<T, Iso> extends
Schema
<T> with an Iso type that
describes the isomorphic counterpart used by the optic layer. Crucially,
decoding and encoding require no Effect services (DecodingServices and
EncodingServices are both never), which means the optic can operate
purely without an Effect runtime.
Most primitive schemas (e.g. Schema.String, Schema.Number) implement
Optic automatically. You normally interact with this interface through
Optic_
utilities rather than constructing it directly.
Optic<out function (type parameter) T in Optic<out T, out Iso>T, out function (type parameter) Iso in Optic<out T, out Iso>Iso> extends interface Schema<out T>Namespace of type-level helpers for
Schema
.
A typed view of a schema that tracks only the decoded (output) type T.
Details
Use Schema<T> as a constraint when you want to accept "any schema that
decodes to T" and do not need to know or constrain the encoded
representation, required services, or any other type parameters.
This is a structural interface — concrete schema values are produced by the
constructors in this module (e.g.
Struct
,
String
,
Number
).
When you also need the encoded type or service requirements, use
Codec
.
Example (Accepting any schema decoding to string)
import { Schema } from "effect"
declare function print(schema: Schema.Schema<string>): void
print(Schema.String) // ok
print(Schema.NonEmptyString) // ok
Schema<function (type parameter) T in Optic<out T, out Iso>T> {
readonly "Iso": function (type parameter) Iso in Optic<out T, out Iso>Iso
readonly "DecodingServices": never
readonly "EncodingServices": never
readonly "Rebuild": interface Optic<out T, out Iso>A schema that additionally supports optic (lens/prism) operations.
Details
Optic<T, Iso> extends
Schema
<T> with an Iso type that
describes the isomorphic counterpart used by the optic layer. Crucially,
decoding and encoding require no Effect services (DecodingServices and
EncodingServices are both never), which means the optic can operate
purely without an Effect runtime.
Most primitive schemas (e.g. Schema.String, Schema.Number) implement
Optic automatically. You normally interact with this interface through
Optic_
utilities rather than constructing it directly.
Optic<function (type parameter) T in Optic<out T, out Iso>T, function (type parameter) Iso in Optic<out T, out Iso>Iso>
}