Skip to main content

Module effect_event

Module effect_event 

Source
Expand description

EffectEvent — opaque builtin representing one recorded effect emission.

In Oracle v1’s trace API, each call to trace.event(k) returns an Option<EffectEvent>. The event carries enough data to answer:

  • “What effect method was emitted?” → event.is(Console.print)
  • “What value was passed?” → match event ... Some(Console.print(msg))
  • “Is it equal to this literal?” → trace.contains(Console.print("hi"))

User code never constructs EffectEvent directly. Three elaboration paths in verify-trace context produce event values:

  • Expression position: Console.print("x") → event literal.
  • Pattern position: Console.print(msg) in a match arm → destructuring.
  • Bare reference: Console.print → effect-type predicate (used with event.is(...) and overloaded trace.contains(...)).

Internal representation: { method: String, args: List<Value> } where args carries the runtime values emitted, typed per the effect method’s signature (polymorphic T for Console.print, concrete types for classified generative effects).

Constants§

FIELD_ARGS
FIELD_METHOD
FIELD_PATH
Dewey-decimal path string identifying the structural position where the event was emitted. Empty for sequential-level events (outside any !/?! group) — matches the BranchPath.root convention. BranchPath.parse(event.path) round-trips the value back to an opaque BranchPath.
TYPE_NAME

Functions§

register
Construct the arena type registration. Called alongside other builtin record types from vm::register_service_types.