TagWithDefaults<T, D>Tag after defaults (pipe or factory { defaults } sugar).
Keeps T (shallow PipeableTag pipe — no HyperlinkTag<Self,…> rebuild,
so class X extends Tag<X>().pipe(defaults) does not recurse on X). Widens
what yield* Tag / Shape see by intersecting a covariant
Effect<Svc & Bag> and a widened Service property. Soundness:
test/defaults-handle.test-d.ts.
export type type TagWithDefaults<
T,
D extends DefaultsBag
> = T & {
readonly Service: ServiceOfTag<T> &
MergedDefaultsBag<T, D>
readonly [defaultsSym]: MergedDefaultsBag<T, D>
} & Effect.Effect<
ServiceOfTag<T> & PriorDefaults<T> & D,
never,
never
>
Tag after
defaults
(pipe or factory { defaults } sugar).
Keeps T (shallow
PipeableTag
pipe — no HyperlinkTag<Self,…> rebuild,
so class X extends Tag<X>().pipe(defaults) does not recurse on X). Widens
what yield* Tag /
Shape
see by intersecting a covariant
Effect<Svc & Bag> and a widened Service property. Soundness:
test/defaults-handle.test-d.ts.
TagWithDefaults<function (type parameter) T in type TagWithDefaults<T, D extends DefaultsBag>T, function (type parameter) D in type TagWithDefaults<T, D extends DefaultsBag>D extends type DefaultsBag = {
readonly [key: string]: unknown
}
A bag of Tag-baked defaults for
defaults
.
DefaultsBag> = function (type parameter) T in type TagWithDefaults<T, D extends DefaultsBag>T & {
readonly [const defaultsSym: typeof defaultsSymWhere piped
defaults
are stowed on a Tag — merged onto the service at local/client
acquire (overridable via matching impl keys /
Layer.updateService
).
defaultsSym]: type MergedDefaultsBag<
T,
D extends DefaultsBag
> = PriorDefaults<T> & D
Merged piped bag after applying D onto T's prior defaults.
MergedDefaultsBag<function (type parameter) T in type TagWithDefaults<T, D extends DefaultsBag>T, function (type parameter) D in type TagWithDefaults<T, D extends DefaultsBag>D>;
readonly type Service: ServiceOfTag<T> & PriorDefaults<T> & DService: type ServiceOfTag<T> = T extends {
readonly Service: infer Svc
}
? Svc
: never
Service shape of a piped Tag before bag widen (from Service, else never).
ServiceOfTag<function (type parameter) T in type TagWithDefaults<T, D extends DefaultsBag>T> & type MergedDefaultsBag<
T,
D extends DefaultsBag
> = PriorDefaults<T> & D
Merged piped bag after applying D onto T's prior defaults.
MergedDefaultsBag<function (type parameter) T in type TagWithDefaults<T, D extends DefaultsBag>T, function (type parameter) D in type TagWithDefaults<T, D extends DefaultsBag>D>;
} & 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<type ServiceOfTag<T> = T extends {
readonly Service: infer Svc
}
? Svc
: never
Service shape of a piped Tag before bag widen (from Service, else never).
ServiceOfTag<function (type parameter) T in type TagWithDefaults<T, D extends DefaultsBag>T> & type MergedDefaultsBag<
T,
D extends DefaultsBag
> = PriorDefaults<T> & D
Merged piped bag after applying D onto T's prior defaults.
MergedDefaultsBag<function (type parameter) T in type TagWithDefaults<T, D extends DefaultsBag>T, function (type parameter) D in type TagWithDefaults<T, D extends DefaultsBag>D>, never, never>;