<T extends PipeableTag>(
readiness: ReadinessOf<
T extends HyperlinkTag<any, infer S extends Spec>
? ServiceOf<S, any>
: never
>
): (tag: T) => T
<Self, S extends Spec, HSelf>(
tag: NodeBoundTag<Self, S, HSelf>,
readiness: ReadinessOf<ServiceOf<S, Self>>
): NodeBoundTag<Self, S, HSelf>
<Self, S extends Spec>(
tag: HyperlinkTag<Self, S>,
readiness: ReadinessOf<ServiceOf<S, Self>>
): HyperlinkTag<Self, S>Attach a Readiness derivation to a tag — the seam the node's /health and NodeStatus
aggregate over. Each contract applies it from its own status (so readiness can't drift from
status); a bare Hyperlink.Tag can opt in the same way. Dual (data-first or .pipe):
class EdgeCache extends Hyperlink.Tag<EdgeCache>()("edge/Cache", {
warm: Hyperlink.effect(Schema.Boolean),
}).pipe(
Hyperlink.withReadiness((svc) =>
Effect.map(svc.warm, (warm) => ({ ready: warm, ...(warm ? {} : { detail: "cold" }) })),
),
) {}export const const withReadiness: {
<T extends PipeableTag>(
readiness: ReadinessOf<
T extends HyperlinkTag<
any,
infer S extends Spec
>
? ServiceOf<S, any>
: never
>
): (tag: T) => T
<Self, S extends Spec, HSelf>(
tag: NodeBoundTag<Self, S, HSelf>,
readiness: ReadinessOf<ServiceOf<S, Self>>
): NodeBoundTag<Self, S, HSelf>
<Self, S extends Spec>(
tag: HyperlinkTag<Self, S>,
readiness: ReadinessOf<ServiceOf<S, Self>>
): HyperlinkTag<Self, S>
}
Attach a
Readiness
derivation to a tag — the seam the node's /health and NodeStatus
aggregate over. Each contract applies it from its own status (so readiness can't drift from
status); a bare
Hyperlink.Tag
can opt in the same way. Dual (data-first or .pipe):
class EdgeCache extends Hyperlink.Tag<EdgeCache>()("edge/Cache", {
warm: Hyperlink.effect(Schema.Boolean),
}).pipe(
Hyperlink.withReadiness((svc) =>
Effect.map(svc.warm, (warm) => ({ ready: warm, ...(warm ? {} : { detail: "cold" }) })),
),
) {}
withReadiness: {
// Data-last: `T extends PipeableTag` (shallow) — do not constrain against HyperlinkTag|NodeBoundTag
// or stock tsc TS2589s on node-bound `class extends Tag()(…).pipe(withReadiness(…))` (expands Svc).
// Readiness `svc` is still `ServiceOf<S, any>` from the inferred tag; Self is widened so class
// `extends` does not recurse on the declaring type — see test/resource-withreadiness-pipe.test-d.ts.
//
// data-last (pipe): `tag.pipe(Hyperlink.withReadiness(fn))` — service type derived from the piped tag.
<function (type parameter) T in <T extends PipeableTag>(readiness: ReadinessOf<T extends HyperlinkTag<any, infer S extends Spec> ? ServiceOf<S, any> : never>): (tag: T) => TT extends type PipeableTag = {
readonly [specSym]: FlatSpec
}
PipeableTag>(
readiness: ReadinessOf<
T extends HyperlinkTag<
any,
infer S extends Spec
>
? ServiceOf<S, any>
: never
>
readiness: type ReadinessOf<Service> = (
service: Service,
base: Effect.Effect<Readiness, never, any>
) => Effect.Effect<Readiness, never, any>
Derive
Readiness
from a resource's materialized service — read its status, don't store new
state. The second argument, base, is the readiness already on the tag (e.g. a contract
factory's own check) — yield* base to extend it (a queue's phase === "running" and your
dependency checks), or ignore it to replace it. Stacks: each
withReadiness
wraps the prior.
Attach one with
withReadiness
; read the result with
readinessCheck
.
ReadinessOf<
function (type parameter) T in <T extends PipeableTag>(readiness: ReadinessOf<T extends HyperlinkTag<any, infer S extends Spec> ? ServiceOf<S, any> : never>): (tag: T) => TT extends interface HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>The type of a resource tag carrying spec S — what
Hyperlink.Tag
/ a
Hyperlink.tagFor
factory produce (and what you extend). Lets a consumer write
<S extends Spec>(tag: HyperlinkTag<Self, S>) and read the spec through named types
(
specOf
/
groupOf
) instead of a Parameters<typeof specOf> workaround.
HyperlinkTag<any, infer function (type parameter) SS extends Spec> ? type ServiceOf<S extends Spec, Self = unknown> = { [K in keyof { readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends {
readonly _tag: "constant";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
...;
} ? Subscribable<...> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }]: { readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends {
readonly _tag: "constant";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
...;
} ? Subscribable<...> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }[K]; } extends infer B ? B : never
The full service interface inferred from a
Spec
. Wire
Method
s map to
Effect/function members; off-wire
LocalMethod
s surface as
Effect<T, never, Local<Self>> — yield* to obtain the value, requiring the local layer
(
Local
) (so they're uncallable through
Hyperlink.client
).
ServiceOf<function (type parameter) SS, any> : never
>,
): (tag: T extends PipeableTagtag: function (type parameter) T in <T extends PipeableTag>(readiness: ReadinessOf<T extends HyperlinkTag<any, infer S extends Spec> ? ServiceOf<S, any> : never>): (tag: T) => TT) => function (type parameter) T in <T extends PipeableTag>(readiness: ReadinessOf<T extends HyperlinkTag<any, infer S extends Spec> ? ServiceOf<S, any> : never>): (tag: T) => TT;
// data-first: `Hyperlink.withReadiness(tag, fn)` — full `ServiceOf<S, Self>` (contracts use this).
// Two **inferred** overloads (not a fixed `<any,any>` union) so a fully-defined *class* — a
// `typeof X` constructor — is accepted, the way `client`/`layer` accept one; node-bound first so a
// node-bound tag keeps its node in the return.
<function (type parameter) Self in <Self, S extends Spec, HSelf>(tag: NodeBoundTag<Self, S, HSelf>, readiness: ReadinessOf<ServiceOf<S, Self>>): NodeBoundTag<Self, S, HSelf>Self, function (type parameter) S in <Self, S extends Spec, HSelf>(tag: NodeBoundTag<Self, S, HSelf>, readiness: ReadinessOf<ServiceOf<S, Self>>): NodeBoundTag<Self, S, HSelf>S extends Spec, function (type parameter) HSelf in <Self, S extends Spec, HSelf>(tag: NodeBoundTag<Self, S, HSelf>, readiness: ReadinessOf<ServiceOf<S, Self>>): NodeBoundTag<Self, S, HSelf>HSelf>(
tag: NodeBoundTag<Self, S, HSelf>(parameter) tag: {
groupId: string;
description: string | undefined;
key: Identifier;
of: (this: void, self: Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends { readonly _tag: 'constant'; } ? SuccessOf…;
context: (self: Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends { readonly _tag: 'constant'; } ? SuccessOf<AsMethod<S[…;
use: (f: (service: Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends { readonly _tag: 'constant'; } ? SuccessOf<AsMe…;
useSync: (f: (service: Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends { readonly _tag: 'constant'; } ? SuccessOf<AsMe…;
Identifier: Identifier;
Service: Shape;
stack: string | undefined;
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;
}
tag: interface NodeBoundTag<Self, S extends Spec, HSelf, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>A
HyperlinkTag
bound to a concrete
Node
— its [nodeSym] narrowed to that node's
NodeKey<HSelf>, which is how
Hyperlink.client
discriminates the node-aware path. Returned
by the node-bearing tag constructors. It's a named type (not an inline & { [nodeSym] }) so a
consumer can export a node-bearing tag without leaking the internal symbol (TS4020).
NodeBoundTag<function (type parameter) Self in <Self, S extends Spec, HSelf>(tag: NodeBoundTag<Self, S, HSelf>, readiness: ReadinessOf<ServiceOf<S, Self>>): NodeBoundTag<Self, S, HSelf>Self, function (type parameter) S in <Self, S extends Spec, HSelf>(tag: NodeBoundTag<Self, S, HSelf>, readiness: ReadinessOf<ServiceOf<S, Self>>): NodeBoundTag<Self, S, HSelf>S, function (type parameter) HSelf in <Self, S extends Spec, HSelf>(tag: NodeBoundTag<Self, S, HSelf>, readiness: ReadinessOf<ServiceOf<S, Self>>): NodeBoundTag<Self, S, HSelf>HSelf>,
readiness: ReadinessOf<ServiceOf<S, Self>>readiness: type ReadinessOf<Service> = (
service: Service,
base: Effect.Effect<Readiness, never, any>
) => Effect.Effect<Readiness, never, any>
Derive
Readiness
from a resource's materialized service — read its status, don't store new
state. The second argument, base, is the readiness already on the tag (e.g. a contract
factory's own check) — yield* base to extend it (a queue's phase === "running" and your
dependency checks), or ignore it to replace it. Stacks: each
withReadiness
wraps the prior.
Attach one with
withReadiness
; read the result with
readinessCheck
.
ReadinessOf<type ServiceOf<S extends Spec, Self = unknown> = { [K in keyof { readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends {
readonly _tag: "constant";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
...;
} ? Subscribable<...> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }]: { readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends {
readonly _tag: "constant";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
...;
} ? Subscribable<...> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }[K]; } extends infer B ? B : never
The full service interface inferred from a
Spec
. Wire
Method
s map to
Effect/function members; off-wire
LocalMethod
s surface as
Effect<T, never, Local<Self>> — yield* to obtain the value, requiring the local layer
(
Local
) (so they're uncallable through
Hyperlink.client
).
ServiceOf<function (type parameter) S in <Self, S extends Spec, HSelf>(tag: NodeBoundTag<Self, S, HSelf>, readiness: ReadinessOf<ServiceOf<S, Self>>): NodeBoundTag<Self, S, HSelf>S, function (type parameter) Self in <Self, S extends Spec, HSelf>(tag: NodeBoundTag<Self, S, HSelf>, readiness: ReadinessOf<ServiceOf<S, Self>>): NodeBoundTag<Self, S, HSelf>Self>>,
): interface NodeBoundTag<Self, S extends Spec, HSelf, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>A
HyperlinkTag
bound to a concrete
Node
— its [nodeSym] narrowed to that node's
NodeKey<HSelf>, which is how
Hyperlink.client
discriminates the node-aware path. Returned
by the node-bearing tag constructors. It's a named type (not an inline & { [nodeSym] }) so a
consumer can export a node-bearing tag without leaking the internal symbol (TS4020).
NodeBoundTag<function (type parameter) Self in <Self, S extends Spec, HSelf>(tag: NodeBoundTag<Self, S, HSelf>, readiness: ReadinessOf<ServiceOf<S, Self>>): NodeBoundTag<Self, S, HSelf>Self, function (type parameter) S in <Self, S extends Spec, HSelf>(tag: NodeBoundTag<Self, S, HSelf>, readiness: ReadinessOf<ServiceOf<S, Self>>): NodeBoundTag<Self, S, HSelf>S, function (type parameter) HSelf in <Self, S extends Spec, HSelf>(tag: NodeBoundTag<Self, S, HSelf>, readiness: ReadinessOf<ServiceOf<S, Self>>): NodeBoundTag<Self, S, HSelf>HSelf>;
<function (type parameter) Self in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, readiness: ReadinessOf<ServiceOf<S, Self>>): HyperlinkTag<Self, S>Self, function (type parameter) S in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, readiness: ReadinessOf<ServiceOf<S, Self>>): HyperlinkTag<Self, S>S extends Spec>(
tag: HyperlinkTag<Self, S>(parameter) tag: {
groupId: string;
description: string | undefined;
key: Identifier;
of: (this: void, self: Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends { readonly _tag: 'constant'; } ? SuccessOf…;
context: (self: Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends { readonly _tag: 'constant'; } ? SuccessOf<AsMethod<S[…;
use: (f: (service: Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends { readonly _tag: 'constant'; } ? SuccessOf<AsMe…;
useSync: (f: (service: Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends { readonly _tag: 'constant'; } ? SuccessOf<AsMe…;
Identifier: Identifier;
Service: Shape;
stack: string | undefined;
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;
}
tag: interface HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>The type of a resource tag carrying spec S — what
Hyperlink.Tag
/ a
Hyperlink.tagFor
factory produce (and what you extend). Lets a consumer write
<S extends Spec>(tag: HyperlinkTag<Self, S>) and read the spec through named types
(
specOf
/
groupOf
) instead of a Parameters<typeof specOf> workaround.
HyperlinkTag<function (type parameter) Self in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, readiness: ReadinessOf<ServiceOf<S, Self>>): HyperlinkTag<Self, S>Self, function (type parameter) S in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, readiness: ReadinessOf<ServiceOf<S, Self>>): HyperlinkTag<Self, S>S>,
readiness: ReadinessOf<ServiceOf<S, Self>>readiness: type ReadinessOf<Service> = (
service: Service,
base: Effect.Effect<Readiness, never, any>
) => Effect.Effect<Readiness, never, any>
Derive
Readiness
from a resource's materialized service — read its status, don't store new
state. The second argument, base, is the readiness already on the tag (e.g. a contract
factory's own check) — yield* base to extend it (a queue's phase === "running" and your
dependency checks), or ignore it to replace it. Stacks: each
withReadiness
wraps the prior.
Attach one with
withReadiness
; read the result with
readinessCheck
.
ReadinessOf<type ServiceOf<S extends Spec, Self = unknown> = { [K in keyof { readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends {
readonly _tag: "constant";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
...;
} ? Subscribable<...> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }]: { readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<T, never, Self> : S[K] extends {
readonly _tag: "constant";
} ? SuccessOf<AsMethod<S[K]>> : S[K] extends {
...;
} ? Subscribable<...> : S[K] extends {
...;
} ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }[K]; } extends infer B ? B : never
The full service interface inferred from a
Spec
. Wire
Method
s map to
Effect/function members; off-wire
LocalMethod
s surface as
Effect<T, never, Local<Self>> — yield* to obtain the value, requiring the local layer
(
Local
) (so they're uncallable through
Hyperlink.client
).
ServiceOf<function (type parameter) S in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, readiness: ReadinessOf<ServiceOf<S, Self>>): HyperlinkTag<Self, S>S, function (type parameter) Self in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, readiness: ReadinessOf<ServiceOf<S, Self>>): HyperlinkTag<Self, S>Self>>,
): interface HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>The type of a resource tag carrying spec S — what
Hyperlink.Tag
/ a
Hyperlink.tagFor
factory produce (and what you extend). Lets a consumer write
<S extends Spec>(tag: HyperlinkTag<Self, S>) and read the spec through named types
(
specOf
/
groupOf
) instead of a Parameters<typeof specOf> workaround.
HyperlinkTag<function (type parameter) Self in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, readiness: ReadinessOf<ServiceOf<S, Self>>): HyperlinkTag<Self, S>Self, function (type parameter) S in <Self, S extends Spec>(tag: HyperlinkTag<Self, S>, readiness: ReadinessOf<ServiceOf<S, Self>>): HyperlinkTag<Self, S>S>;
} = import FnFn.const dual: <(...args: Array<any>) => any, <T extends HyperlinkTag<any, any, any>>(tag: T, readiness: ReadinessOf<unknown>) => T>(arity: 2, body: <T extends HyperlinkTag<any, any, any>>(tag: T, readiness: ReadinessOf<unknown>) => T) => ((...args: Array<any>) => any) & (<T extends HyperlinkTag<any, any, any>>(tag: T, readiness: ReadinessOf<unknown>) => T) (+1 overload)Creates a function that can be called in data-first style or data-last
(pipe-friendly) style.
When to use
Use to expose one implementation through both direct and pipe-friendly
call styles.
Details
Pass either the arity of the uncurried function or a predicate that decides
whether the current call is data-first. Arity is the common case. Use a
predicate when optional arguments make arity ambiguous.
Example (Selecting data-first or data-last style by arity)
import { Function, pipe } from "effect"
const sum = Function.dual<
(that: number) => (self: number) => number,
(self: number, that: number) => number
>(2, (self, that) => self + that)
console.log(sum(2, 3)) // 5
console.log(pipe(2, sum(3))) // 5
Example (Defining overloads with call signatures)
import { Function, pipe } from "effect"
const sum: {
(that: number): (self: number) => number
(self: number, that: number): number
} = Function.dual(2, (self: number, that: number): number => self + that)
console.log(sum(2, 3)) // 5
console.log(pipe(2, sum(3))) // 5
Example (Selecting data-first or data-last style with a predicate)
import { Function, pipe } from "effect"
const sum = Function.dual<
(that: number) => (self: number) => number,
(self: number, that: number) => number
>(
(args) => args.length === 2,
(self, that) => self + that
)
console.log(sum(2, 3)) // 5
console.log(pipe(2, sum(3))) // 5
dual(
2,
<function (type parameter) T in <T extends HyperlinkTag<any, any, any>>(tag: T, readiness: ReadinessOf<unknown>): TT extends interface HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>The type of a resource tag carrying spec S — what
Hyperlink.Tag
/ a
Hyperlink.tagFor
factory produce (and what you extend). Lets a consumer write
<S extends Spec>(tag: HyperlinkTag<Self, S>) and read the spec through named types
(
specOf
/
groupOf
) instead of a Parameters<typeof specOf> workaround.
HyperlinkTag<any, any, any>>(tag: T extends HyperlinkTag<any, any, any>tag: function (type parameter) T in <T extends HyperlinkTag<any, any, any>>(tag: T, readiness: ReadinessOf<unknown>): TT, readiness: ReadinessOf<unknown>readiness: type ReadinessOf<Service> = (
service: Service,
base: Effect.Effect<Readiness, never, any>
) => Effect.Effect<Readiness, never, any>
Derive
Readiness
from a resource's materialized service — read its status, don't store new
state. The second argument, base, is the readiness already on the tag (e.g. a contract
factory's own check) — yield* base to extend it (a queue's phase === "running" and your
dependency checks), or ignore it to replace it. Stacks: each
withReadiness
wraps the prior.
Attach one with
withReadiness
; read the result with
readinessCheck
.
ReadinessOf<unknown>): function (type parameter) T in <T extends HyperlinkTag<any, any, any>>(tag: T, readiness: ReadinessOf<unknown>): TT => {
// Stack onto any readiness already on the tag (e.g. a contract factory's own check): the new
// derivation receives the prior one (applied to the same service) as `base`, so it can extend
// it (`yield* base`) or replace it (ignore `base`). `base` flows down the chain from the root.
const const prior:
| ReadinessOf<{
readonly [x: string]: unknown
}>
| undefined
prior = tag: T extends HyperlinkTag<any, any, any>tag[const readinessSym: typeof readinessSymWhere a resource's readiness derivation (status → ready) is stowed on a Tag — a sibling of
kindSym
, applied by
withReadiness
. Absent ⇒ the resource is ready by default.
readinessSym];
const const composed: (
service: unknown,
base: Effect.Effect<Readiness, never, never>
) => any
composed = (service: unknownservice: unknown, base: Effect.Effect<Readiness, never, never>(parameter) base: {
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;
}
base: 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<Readiness, never, never>) =>
readiness: ReadinessOf<unknown>readiness(service: unknownservice, const prior:
| ReadinessOf<{
readonly [x: string]: unknown
}>
| undefined
prior === var undefinedundefined ? base: Effect.Effect<Readiness, never, never>(parameter) base: {
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;
}
base : (const prior: ReadinessOf<{
readonly [x: string]: unknown
}>
prior as any)(service: unknownservice, base: Effect.Effect<Readiness, never, never>(parameter) base: {
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;
}
base)) as any;
return var Object: ObjectConstructorProvides functionality common to all JavaScript objects.
Object.ObjectConstructor.assign<T, {
[readinessSym]: (service: unknown, base: Effect.Effect<Readiness, never, never>) => any;
}>(target: T, source: {
[readinessSym]: (service: unknown, base: Effect.Effect<Readiness, never, never>) => any;
}): T & {
[readinessSym]: (service: unknown, base: Effect.Effect<Readiness, never, never>) => any;
} (+3 overloads)
Copy the values of all of the enumerable own properties from one or more source objects to a
target object. Returns the target object.
assign(tag: T extends HyperlinkTag<any, any, any>tag, { [const readinessSym: typeof readinessSymWhere a resource's readiness derivation (status → ready) is stowed on a Tag — a sibling of
kindSym
, applied by
withReadiness
. Absent ⇒ the resource is ready by default.
readinessSym]: const composed: (
service: unknown,
base: Effect.Effect<Readiness, never, never>
) => any
composed }) as function (type parameter) T in <T extends HyperlinkTag<any, any, any>>(tag: T, readiness: ReadinessOf<unknown>): TT;
},
);