typeof URIDefines the unique symbol used to associate TypeClass implementations with their TypeLambda.
When to use
Use when you need to define a custom type class that exposes the TypeLambda
it operates on.
Details
This symbol links a type class shape with its compile-time type lambda. It is intended for type-class definitions and has no runtime behavior.
Example (Linking a type class to a type lambda)
import type { HKT } from "effect"
interface IdentityTypeLambda extends HKT.TypeLambda {
readonly type: this["Target"]
}
interface IdentityTypeClass extends HKT.TypeClass<IdentityTypeLambda> {
readonly [HKT.URI]?: IdentityTypeLambda
readonly of: <A>(value: A) => HKT.Kind<IdentityTypeLambda, never, never, never, A>
}
const identity: IdentityTypeClass = {
of: (value) => value
}
type LinkedTypeLambda = typeof identity[typeof HKT.URI]
const value: HKT.Kind<NonNullable<LinkedTypeLambda>, never, never, never, string> = identity.of("ok")
console.log(value) // "ok"export declare const const URI: typeof URIDefines the unique symbol used to associate TypeClass implementations with their TypeLambda.
When to use
Use when you need to define a custom type class that exposes the TypeLambda
it operates on.
Details
This symbol links a type class shape with its compile-time type lambda. It is
intended for type-class definitions and has no runtime behavior.
Example (Linking a type class to a type lambda)
import type { HKT } from "effect"
interface IdentityTypeLambda extends HKT.TypeLambda {
readonly type: this["Target"]
}
interface IdentityTypeClass extends HKT.TypeClass<IdentityTypeLambda> {
readonly [HKT.URI]?: IdentityTypeLambda
readonly of: <A>(value: A) => HKT.Kind<IdentityTypeLambda, never, never, never, A>
}
const identity: IdentityTypeClass = {
of: (value) => value
}
type LinkedTypeLambda = typeof identity[typeof HKT.URI]
const value: HKT.Kind<NonNullable<LinkedTypeLambda>, never, never, never, string> = identity.of("ok")
console.log(value) // "ok"
URI: unique symbol