Skuld.Comp.ISentinel protocol (skuld v0.1.26)
View SourceProtocol for handling sentinel values in run/run! and generic sentinel inspection.
Sentinels are control flow values (Suspend, Throw, etc.) that bypass normal computation flow. This protocol allows generic handling without coupling to specific sentinel types.
Sentinel Categories
Sentinels fall into two categories:
Suspend sentinels (
suspend?/1returns true): ExternalSuspend, InternalSuspend These represent suspended computations that can be resumed.Error sentinels (
error?/1returns true): Throw, Cancelled These represent error conditions that propagate up the call stack.
Plain values have sentinel?/1, suspend?/1, and error?/1 all return false.
Summary
Functions
Is this an error sentinel (Throw, Cancelled)?
Complete a computation result - invoke leave_scope or bypass for sentinels
Extract value or raise for sentinel types
Is this a sentinel value? Returns false for plain values.
Get the serializable payload (struct fields minus :resume). Used for logging/serialization.
Is this a suspend sentinel (ExternalSuspend, InternalSuspend)?
Types
@type t() :: term()
All the types that implement this protocol.
Functions
Is this an error sentinel (Throw, Cancelled)?
@spec run(t(), Skuld.Comp.Types.env()) :: {Skuld.Comp.Types.result(), Skuld.Comp.Types.env()}
Complete a computation result - invoke leave_scope or bypass for sentinels
Extract value or raise for sentinel types
Is this a sentinel value? Returns false for plain values.
Get the serializable payload (struct fields minus :resume). Used for logging/serialization.
Is this a suspend sentinel (ExternalSuspend, InternalSuspend)?