InjectLocal<T, Self>Inject the Local capability into a service member's requirement channel — how a
fromService local member surfaces. An Effect/Stream-returning member (or a function to
one) keeps its shape and gains Local<Self> in its requirements; any other value is obtained via
Effect<T, never, Local<Self>>. Regular (local) layers satisfy Local; a client layer can't, so
calling a local on a client is a compile error.
export type type InjectLocal<T, Self> = T extends Effect.Effect<infer A, infer E, infer R> ? Effect.Effect<A, E, R | Local<Self>> : T extends Stream.Stream<infer A, infer E, infer R> ? Stream.Stream<A, E, Local<Self> | R> : T extends (...args: infer Args) => Effect.Effect<infer A, infer E, infer R> ? (...args: Args) => Effect.Effect<A, E, R | Local<Self>> : T extends (...args: infer Args) => Stream.Stream<infer A, infer E, infer R> ? (...args: Args) => Stream.Stream<A, E, R | Local<Self>> : Effect.Effect<...>Inject the
Local
capability into a service member's requirement channel — how a
fromService
local member surfaces. An Effect/Stream-returning member (or a function to
one) keeps its shape and gains Local<Self> in its requirements; any other value is obtained via
Effect<T, never, Local<Self>>. Regular (local) layers satisfy Local; a client layer can't, so
calling a local on a client is a compile error.
InjectLocal<function (type parameter) T in type InjectLocal<T, Self>T, function (type parameter) Self in type InjectLocal<T, Self>Self> = function (type parameter) T in type InjectLocal<T, Self>T extends 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<infer function (type parameter) AA, infer function (type parameter) EE, infer function (type parameter) RR>
? 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) AA, function (type parameter) EE, function (type parameter) RR | interface Local<in out Self>Granted only by a resource's local layer (
Hyperlink.layer
/
serve
) — never by
Hyperlink.client
. Local to this runtime's materialized impl for the tag (not a remote
client, not a peer). A
LocalMethod
carries it in its requirement channel, so calling a
non-serializable method against a client is a compile error (unsatisfied requirement); the
same call resolves when the local layer is provided. Branded by Self so one resource's local
layer can't unlock another's.
Local<function (type parameter) Self in type InjectLocal<T, Self>Self>>
: function (type parameter) T in type InjectLocal<T, Self>T extends import StreamStream.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<infer function (type parameter) AA, infer function (type parameter) EE, infer function (type parameter) RR>
? import StreamStream.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) AA, function (type parameter) EE, function (type parameter) RR | interface Local<in out Self>Granted only by a resource's local layer (
Hyperlink.layer
/
serve
) — never by
Hyperlink.client
. Local to this runtime's materialized impl for the tag (not a remote
client, not a peer). A
LocalMethod
carries it in its requirement channel, so calling a
non-serializable method against a client is a compile error (unsatisfied requirement); the
same call resolves when the local layer is provided. Branded by Self so one resource's local
layer can't unlock another's.
Local<function (type parameter) Self in type InjectLocal<T, Self>Self>>
: function (type parameter) T in type InjectLocal<T, Self>T extends (...args: Args extends unknown[]args: infer function (type parameter) ArgsArgs) => 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<infer function (type parameter) AA, infer function (type parameter) EE, infer function (type parameter) RR>
? (...args: Args extends unknown[]args: function (type parameter) ArgsArgs) => 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) AA, function (type parameter) EE, function (type parameter) RR | interface Local<in out Self>Granted only by a resource's local layer (
Hyperlink.layer
/
serve
) — never by
Hyperlink.client
. Local to this runtime's materialized impl for the tag (not a remote
client, not a peer). A
LocalMethod
carries it in its requirement channel, so calling a
non-serializable method against a client is a compile error (unsatisfied requirement); the
same call resolves when the local layer is provided. Branded by Self so one resource's local
layer can't unlock another's.
Local<function (type parameter) Self in type InjectLocal<T, Self>Self>>
: function (type parameter) T in type InjectLocal<T, Self>T extends (...args: Args extends unknown[]args: infer function (type parameter) ArgsArgs) => import StreamStream.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<infer function (type parameter) AA, infer function (type parameter) EE, infer function (type parameter) RR>
? (...args: Args extends unknown[]args: function (type parameter) ArgsArgs) => import StreamStream.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) AA, function (type parameter) EE, function (type parameter) RR | interface Local<in out Self>Granted only by a resource's local layer (
Hyperlink.layer
/
serve
) — never by
Hyperlink.client
. Local to this runtime's materialized impl for the tag (not a remote
client, not a peer). A
LocalMethod
carries it in its requirement channel, so calling a
non-serializable method against a client is a compile error (unsatisfied requirement); the
same call resolves when the local layer is provided. Branded by Self so one resource's local
layer can't unlock another's.
Local<function (type parameter) Self in type InjectLocal<T, Self>Self>>
: 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) T in type InjectLocal<T, Self>T, never, interface Local<in out Self>Granted only by a resource's local layer (
Hyperlink.layer
/
serve
) — never by
Hyperlink.client
. Local to this runtime's materialized impl for the tag (not a remote
client, not a peer). A
LocalMethod
carries it in its requirement channel, so calling a
non-serializable method against a client is a compile error (unsatisfied requirement); the
same call resolves when the local layer is provided. Branded by Self so one resource's local
layer can't unlock another's.
Local<function (type parameter) Self in type InjectLocal<T, Self>Self>>;