Glossary

Key terms used throughout this book, in alphabetical order.


~ (bind operator) The prefix operator inside effect!. let x = ~eff runs the sub-effect eff on the same fiber and binds its success value (converting its error with From); ~Cap (a capability type) reads that capability from R; ~(a, b) runs several effects in parallel and binds a tuple.


Backpressure The mechanism by which a slow consumer signals to a fast producer to slow down or drop data. In id_effect, a stream channel's BackpressurePolicy: BoundedBlock, DropNewest, DropOldest or Fail. See Backpressure Policies.


Brand A zero-cost newtype wrapper that creates a distinct type from a primitive. Brand<String, EmailMarker> and Brand<String, NameMarker> are different types even though both wrap String, preventing accidental mixing. See Validation and Refinement.


Capability A Rust type that names a dependency in R (for example Counter, HttpClientService or EffectLogger). The type itself is the key: caps!(Counter) requires it, ~Counter reads it, .provide(Counter(1)) supplies it. See Capability services.


caps!(A, B, …) The macro that spells the environment type HCons<A, HCons<B, HNil>> for Effect<_, _, caps!(A, B)>. See The R Parameter.


Cause<E> The reason an effect failed: Cause::Fail(E) (expected error), Cause::Die(Defect) (panic or defect), Cause::Interrupt(FiberId) (interrupted), combined with Cause::Both (parallel) and Cause::Then (sequential). See Exit.


Chunk<A> A contiguous batch of A values; the unit of data in Stream pipelines. See Chunks.


Clock Time comes from the fiber's executor: sleep, schedules and timeouts use it. The TokioExecutor uses real time; the TestExecutor has a virtual clock that moves only when the test calls advance. See Clock Injection.


commit The id_effect_fp function that lifts an Stm<A, E> into an Effect. Running the effect runs the transaction and retries it on conflict (alias atomically). See Stm and commit.


Effect<A, E = Never, R = HNil> The central type. A lazy, Send description of a computation that succeeds with A, can fail with a typed E, and needs the capabilities in R. Nothing runs until the effect reaches an edge (block_on, Runtime::run); an effect runs once. See What Even Is an Effect?.


effect! macro The do-notation macro: an async-style body in which ~ binds sub-effects and reads capabilities, so sequential effect code needs no nested closures. effect_local! builds a LocalEffect. See The effect! Macro.


effect! macro crates (id_effect_macro, id_effect_proc_macro) effect!, effect_local!, caps! and the derives are procedural macros in id_effect_proc_macro; pipe! and err! are declarative macros in id_effect_macro. id_effect re-exports all of them. See Workspace tooling.


Edge The place where an effect is run: eff.block_on() in main, tests and benches, Runtime::run(eff).await in async code, or a host such as id_effect_cli::run_main or an Axum handler. Library code returns effects instead of running them. See Laziness as a Superpower.


Exit<A, E> The outcome of running an effect: Exit::Success(A) or Exit::Failure(Cause<E>). Returned by block_on and Runtime::run, and by joining a fiber. See Exit.


Fiber A lightweight, independently scheduled unit of concurrent work. Fibers are cheaper than OS threads and support structured interruption: a parent's children are interrupted when it ends. Start one with eff.fork(), wait with handle.join(). See What Are Fibers?.


FiberRef A fiber-scoped dynamic variable. Forked fibers inherit their parent's value; changes don't leak to the parent or siblings. Use for request IDs, trace contexts and other per-fiber state. See FiberRef.


from_async A constructor that lifts a closure returning a Future<Output = Result<A, E>> into an Effect. Use it to wrap third-party futures. See Creating Effects.


HasSchema A trait that attaches a canonical Schema to a type. Implement it (or #[derive(Schema)]) when a type should always be parsed the same way. See Validation and Refinement.


HCons / HNil / hlist! The typed environment is an HList: HCons<A, HCons<B, HNil>> (spelled caps!(A, B)), built as a value with hlist![a, b]. Capabilities are found by type, so their order does not matter to ~Cap or need::<Cap>(). See R Revisited.


id_effect_axum Workspace crate bridging Axum handlers to Effect: an EffectExecutor, routing and JSON + schema helpers, request-scoped capabilities. See Axum host.


id_effect_axum::service tower::Service implementations over effects, behind id_effect_axum's tower feature. See Tower service.


id_effect_cli Workspace crate for CLI entrypoints: optional clap, run_main, and mapping Exit / Cause to process exit codes. See CLI with clap.


id_effect_config Workspace crate for configuration: Config<T> descriptors, Figment/serde extraction, and effectful reads from a config provider in R. See Configuration.


id_effect_fp Maintenance-tier crate holding the functional-programming layer core does not use itself: algebra, persistent collections and stm. See Algebra type classes.


id_effect_lint (labs) Custom rustc lint crate for id_effect-specific rules, in the labs workspace. See Workspace tooling.


id_effect_logger Workspace crate for an injectable EffectLogger service and pluggable log backends. See Logging.


id_effect_platform Workspace crate providing @effect/platform-style HTTP, file system and subprocess traits (HttpClient, FileSystem, ProcessRuntime) with Tokio-backed implementations, as capabilities (HttpClientService, …). See Platform I/O.


id_effect_platform::http::reqwest The reqwest backend of id_effect_platform's HTTP client. See HTTP via reqwest.


id_effect_process / id_effect_node The Process Mesh: OTP-style local processes and supervision trees (id_effect_process), plus distribution, membership and cluster placement (id_effect_node). See Process Mesh overview.


id_effect_resilience Workspace crate for circuit breakers, rate limiters, bulkheads, hedged requests and retry_with_breaker. See Runtime resilience.


id_effect_sql Workspace crate for driver-agnostic SQL as effects (SqlClient, with_transaction, TestSqlClient). Postgres lives in id_effect_sql::pg behind the pg feature. See Data access.


id_effect_tokio Workspace crate: TokioRuntime, which pairs an id_effect Runtime with an owned or ambient Tokio runtime (run, fork, spawn, block_on). The TokioExecutor itself lives in core. See Tokio bridge.


Crate tier Every workspace crate declares a tier (core, runtime, integration, maintenance, labs, merge, example) in [package.metadata.id_effect]; scripts/tier-conformance.sh checks the quality bar for that tier. See ADR 0010.


Labs Unpublished crates with no API guarantees, kept in the separate labs/ Cargo workspace: id_effect_rpc, id_effect_ai, id_effect_parse, id_effect_lint. Use them via path or git dependencies; build with --manifest-path labs/Cargo.toml.


Layer<Out, E, In> A recipe that builds the capabilities Out (an HList) from the capabilities In, possibly failing with E. Compose with merge, provide_to and provide_merge; a layer is built once per build (memoised) and its scoped resources are released when the build's scope closes. #[derive(ProviderSpecDerive)] generates a layer() for a provider struct. See What Is a Provider?.


need::<T>() Requests capability T outside effect!: need::<Db>().map(|db| ..) is an effect whose R contains Db. Inside effect!, write ~Db. See Widening and Narrowing.


Never The uninhabited error type and the default E. Effect<A> (E = Never) cannot fail with a typed error, though it may still die or be interrupted. See Error Handling.


ParseErrors An accumulated collection of ParseError values, each with a path and message, so a decode reports every validation failure at once. See ParseErrors.


provide / provide_env / provide_layer Supply capabilities to an effect: .provide(v) removes one capability from R, .provide_env(hlist![..]) supplies all of them, .provide_layer(layer) builds a Layer and supplies its output. A missing capability is a compile error. See Providing Dependencies.


R (environment type parameter) The third type parameter of Effect<A, E, R>: the capabilities the computation needs, as an HList (caps!(K1, K2)), HNil (the default) when none. See The R Parameter.


Runtime Owns an Executor and the run edges: Runtime::global(), run(eff).await, block_on(eff), fork(eff). eff.block_on() is a shortcut over the global runtime. See Laziness as a Superpower.


Schedule An immutable value describing how to space out repeated or retried operations: Schedule::recurs(n), spaced(d), exponential(base), fibonacci(one), combined with intersect, union, and_then, jittered, up_to. Used with Effect::retry(|| eff, schedule) and Effect::repeat(|| eff, schedule). See Schedule.


Schema A value of type Schema<A, I, E> that decodes wire data into an A and encodes it back. Schemas are composable: build complex schemas from primitive ones. See Schema Combinators.


Scope A resource lifetime boundary. Finalizers registered with a Scope run when it closes, whether by success, failure or interruption. Effect::scoped(|scope| ..) opens one; acquire_use_release covers the common bracket pattern. See Scopes and Finalizers.


Sink A consumer of a Stream that produces one result: Sink::collect(), Sink::fold_left(init, f), Sink::for_each(f), Sink::drain(), or a custom Sink::new(driver); run it with sink.run(stream). See Sinks.


Stm<A, E> An id_effect_fp transactional computation over TRef values. Compose with map / flat_map / or_else; execute with commit (alias atomically). Restarts automatically on conflict or Stm::retry; aborts on Stm::fail. See Stm and commit.


Stream A lazy, pull-based, potentially infinite sequence of values, processed in Chunks. Combinators include map, filter, take, take_while, scan, grouped, flat_map, map_effect_par and merge; run_collect, run_fold and sinks consume it. See Streams.


TestExecutor A deterministic executor for tests with a virtual clock: run_until_stalled runs every ready fiber, advance(d) moves time and fires due timers, so a test of a 10-second retry takes microseconds. See Testing.


TRef<T> A transactional cell: a mutable T that can be read and written inside Stm transactions. Multiple TRefs can be read and written atomically. See TRef.


Unknown The type for unvalidated wire data. All external data enters your program as Unknown and is converted to typed values by running it through a Schema. See The Unknown Type.