Skuld.Comp.Types (skuld v0.3.0)
View SourceType definitions for Skuld.Comp.
These types define the core abstractions of the evidence-passing effect system.
Summary
Types
A computation awaiting execution.
The environment carrying evidence, state, and leave-scope
A handler interprets effect operations
Continuation after an effect
Leave-scope handler - cleans up or redirects
Any result value - opaque to the framework
Effect signature - identifies which handler handles an operation. Can be a simple atom or a tuple for tagged effects.
Transform-suspend handler - decorates ExternalSuspend values when yielding
Types
@type computation() :: computation(term())
A computation awaiting execution.
The type parameter documents what the computation produces when run. Dialyzer erases it (it's a phantom parameter), but it appears in hover docs, ExDoc, and generated specs for readability.
Examples
@spec get_todo(String.t()) :: computation({:ok, Todo.t()} | {:error, term()})
@spec get_todo!(String.t()) :: computation(Todo.t())
@type env() :: Skuld.Comp.Env.t()
The environment carrying evidence, state, and leave-scope
A handler interprets effect operations
Continuation after an effect
Leave-scope handler - cleans up or redirects
@type result() :: term()
Any result value - opaque to the framework
Effect signature - identifies which handler handles an operation. Can be a simple atom or a tuple for tagged effects.
@type transform_suspend() :: (Skuld.Comp.ExternalSuspend.t(), env() -> {Skuld.Comp.ExternalSuspend.t(), env()})
Transform-suspend handler - decorates ExternalSuspend values when yielding