Glossary
Key terms used throughout this book, in alphabetical order.
~ (bind operator)
The prefix operator inside effect! that runs an inner effect and binds its success value to a variable. let x = ~eff runs eff and assigns the result to x; ~eff runs eff and discards the result.
Backpressure
The mechanism by which a slow consumer signals to a fast producer to slow down or drop data. In id_effect, expressed via BackpressurePolicy: Block, DropLatest, DropOldest, or Unbounded. 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.
Cause<E>
The reason an effect failed. Three variants: Cause::Fail(E) (expected error), Cause::Die(Box<dyn Any>) (panic or defect), Cause::Interrupt (cancelled). See Exit.
Chunk<A>
A contiguous, reference-counted batch of A values. The unit of data in Stream pipelines. Cheap to clone; efficient to process in bulk. See Chunks.
Clock
A trait abstracting time. LiveClock uses real system time; TestClock advances only when told to. Inject Clock through the environment so scheduling logic is testable. See Clock Injection.
commit
The function that lifts a Stm<A> into an Effect<A, Never, ()>. Executing the effect runs the STM transaction and retries on conflict. See Stm and commit.
Context<R>
The runtime representation of the environment R — a heterogeneous map from service keys to service values. Built with ctx! or assembled by the Layer system. See Context and HLists.
Effect<A, E, R>
The central type. A description of a computation that: succeeds with a value of type A, can fail with a typed error of type E, and requires environment R. Effects are lazy: nothing runs until you call a runtime function. See What Even Is an Effect?.
effect! macro
The do-notation macro for writing effect programs. Converts ~expr into flat bind chains so you can write sequential effect code without nested closures. See The effect! Macro.
Exit<A, E>
The result of running an effect: Exit::Success(A) or Exit::Failure(Cause<E>). Returned by run_test and accessible via FiberHandle::join. See Exit.
Fiber
A lightweight, independently-scheduled unit of concurrent work. Fibers are cheaper than OS threads and support structured cancellation. Spawn with run_fork; join with handle.join(). See What Are Fibers?.
FiberRef
A fiber-scoped dynamic variable. Each fiber has its own copy; changes don't leak to parent or sibling fibers. Use for request IDs, trace contexts, and other per-fiber state. See FiberRef.
from_async
A constructor that lifts an async closure into an Effect. Use when wrapping third-party library futures that return Future rather than Effect. See Creating Effects.
HList (heterogeneous list)
The compile-time linked list Cons<Head, Tail> / Nil that represents the environment R. Each Cons cell holds one tagged service. You usually don't write HList types manually — use NeedsX traits and ctx!. See Context and HLists.
HasSchema
A trait that attaches a canonical Schema<Self> to a type. Implement it when a type should always be parsed the same way and you want schema-driven tooling to work automatically. See Validation and Refinement.
Layer
A recipe for constructing one or more services from a set of dependencies. Layers compose with .stack() and form a DAG that the runtime resolves automatically. See What Is a Layer?.
NeedsX trait
A supertrait bound on R that expresses "this environment must contain service X." Prefer NeedsDb over Get<DbKey, Here, Target = DbClient> for readability. See Widening and Narrowing.
Never
The uninhabited type. Effect<A, Never, R> cannot fail with a typed error (but may still Die or Interrupt). Eliminate Err(never) branches with absurd(never). See Error Handling.
ParseErrors
An accumulated collection of ParseError values, each with a path and message. Returned by parse(schema, unknown). Reports all validation failures at once, not just the first. See ParseErrors.
R (environment type parameter)
The third type parameter of Effect<A, E, R>. Encodes which services the computation needs. Library functions stay generic over R; binaries and tests supply a concrete Context. See The R Parameter.
run_blocking
The synchronous effect runner. Use in main and integration tests where you want a blocking call. Do not call from within library functions — return Effect instead. See Laziness as a Superpower.
run_test
The test-aware effect runner. Like run_blocking but also detects fiber leaks and uses deterministic scheduling. Use in all #[test] functions. See run_test.
Schedule
A value describing how to space out repeated or retried operations. Combinators: fixed, exponential, linear, .take(n), .until(pred). Used with .retry() and .repeat(). See Schedule.
Schema
A value of type Schema<T> that describes how to parse an Unknown into a T. Schemas are composable: build complex schemas from primitive ones. See Schema Combinators.
Scope
A resource lifetime boundary. Finalizers registered with a Scope run when the scope exits, whether by success, failure, or cancellation. Use acquire_release for the common bracket pattern. See Scopes and Finalizers.
service_key!
A macro that declares a typed service key: service_key!(DbKey: Arc<dyn Db>). The key type-indexes into the environment so services are looked up by type, not by string. See Tags.
Sink
A consumer of Stream elements. Receives Chunks via on_chunk and a completion signal via on_done. Built-in sinks: collect, fold, for_each, drain. See Sinks.
Stm<A>
A transactional computation over TRef values. Compose with stm!; execute with commit or atomically. Retries automatically on conflict; aborts on stm::fail. See Stm and commit.
Stream
A lazy, potentially infinite sequence of values of type A. Processes elements in Chunks. Supports all the combinators of Effect plus streaming-specific operators like flat_map, merge, and take_until. See Streams.
Tag / Tagged
The mechanism for keying services in the environment. A Tag<K, V> associates key type K with value type V. service_key! generates tags and their associated types. See Tags.
TestClock
A Clock implementation for tests. Starts at Unix epoch and advances only when you call .advance(dur) or .set_time(t). Sleep effects complete instantly when the clock passes their wake time. See TestClock.
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.