Skip to content

Discharge

Discharge rewrites a computation that installs authored handlers to an equal one that installs none, with the answer of each handler clause in place of the request it answers. The compiled runtime and the transpile targets that render no handler read the result. The rewriting and its correctness are stated in the semantics of effects.

discharge

Static discharge of authored handlers.

Discharge rewrites a checked computation to an equal one that installs no handler. It evaluates the term with the reference machine's own rules and symbolic values: a handle is a frame of an explicit continuation, a request finds the innermost frame of its instance, the frame's clause body runs with the continuation between the request and the frame captured, and resume puts the captured continuation back with the parameters it names. A value that a step computes is bound under a fresh name in the rewritten term, a request no frame answers stays a request, and an if whose condition is not a literal stays an if over the rewritten branches, which meet again where both reach one continuation.

The four resumption grades are one rule. A clause that resumes twice puts its captured continuation back twice, and one that never resumes drops it. Surviving direct requests record the shot labels of the copied continuations that reach them and the ancestry of the linear operation clauses they run in. A surviving request inside a discharged shot keeps the computation on the reference machine if its operation has a checked unrestricted clause. A residual effectful call in a discharged clause keeps its reference continuation. A linear clause with effects can record the source sites of captured acyclic calls.

The result depends on no target and no runtime. The compiled runtime, the transpile planner, the static targets' projection, and the capability analysis read it, so a handler is discharged for all of them or for none.

DISCHARGE_STATEMENTS module-attribute

DISCHARGE_STATEMENTS = 2048

The most statements a discharged computation may have.

A clause that resumes m times copies the rest of the computation m times, so n such requests in sequence yield m ** n copies, and a conditional whose branches differ in k values is stated k times. A computation past this bound is left as it is.

DISCHARGE_STEPS module-attribute

DISCHARGE_STEPS = 65536

The most reduction steps one computation's discharge may take.

Discharge reduces a term without entering a recursive call, so it terminates. The bound stops a reduction whose copies produce no statement of their own.

ObstacleKind

ObstacleKind = Literal['foreign', 'forwarding', 'recursion', 'case', 'growth', 'address', 'resumption-grade', 'tunnel']

What stops a handler from being discharged.

DischargeObstacle didactic-model

DischargeObstacle(*, computation: str, kind: ObstacleKind = field(opaque=True, extras=OPAQUE_BY_VALUE), reason: str, origin: SourceOrigin | None = field(default=None, opaque=True, extras=OPAQUE_BY_VALUE))

Bases: QiecModel

Why a computation's handlers are not discharged.

PARAMETER DESCRIPTION
computation

The computation left as it is.

TYPE: str

kind

"foreign" for a handler a runtime provider implements, "forwarding" for a request whose handler has no clause for it and which no outer handler of the computation answers, "recursion" for a recursive call that makes handled requests, "case" for a case analysis on a value known only at run time whose branches do not meet in one continuation, "growth" for a rewriting past the size bounds, and "address" when a surviving operation can open a runtime shot inside one being discharged, a residual effectful call needs its original clause scope, or a shared resumption needs its original counter for a surviving address. "resumption-grade" means discharge cannot preserve a clause's usage check or the runtime's copy permission. Several shots can reach the same unspent one-shot token, and a captured opaque sampleable can require permission to copy. "tunnel" is a mask whose skipped handler is not compiled by evidence passing.

TYPE: ObstacleKind DEFAULT: field(opaque=True, extras=OPAQUE_BY_VALUE)

reason

The obstacle as a clause naming the handler and the clause, to follow "the computation".

TYPE: str

origin

Where the obstacle is written, when the term records it.

TYPE: SourceOrigin | None DEFAULT: field(default=None, opaque=True, extras=OPAQUE_BY_VALUE)

DischargeRewrite didactic-model

DischargeRewrite(*, computation: ComputationId = field(opaque=True, extras=OPAQUE_BY_VALUE), method: Literal['handler-discharge', 'recursive-state', 'evidence-passing'], companions: tuple[ComputationId, ...] = field(default=(), opaque=True, extras=OPAQUE_BY_VALUE))

Bases: QiecModel

A rewrite actually selected for a checked source computation.

PARAMETER DESCRIPTION
computation

The computation whose body was replaced.

TYPE: ComputationId DEFAULT: field(opaque=True, extras=OPAQUE_BY_VALUE)

method

The checked transformation that replaced the body. "evidence-passing" compiles tail-resumptive handlers to inlined clause code (quivers.qiec.evidence_passing).

TYPE: ('handler-discharge', 'recursive-state', 'evidence-passing') DEFAULT: "handler-discharge"

companions

First-order computations added by the recursive-state transformation, or callees specialized to evidence. Companions can also represent acyclic calls or shared pure transitions.

TYPE: tuple[ComputationId, ...] DEFAULT: field(default=(), opaque=True, extras=OPAQUE_BY_VALUE)

DischargedModule didactic-model

DischargedModule(*, module: QiecModule = field(opaque=True, extras=OPAQUE_BY_VALUE), obstacles: tuple[DischargeObstacle, ...] = field(default=(), opaque=True, extras=OPAQUE_BY_VALUE), rewrites: tuple[DischargeRewrite, ...] = field(default=(), opaque=True, extras=OPAQUE_BY_VALUE))

Bases: QiecModel

A module whose computations install no handler that can be discharged.

PARAMETER DESCRIPTION
module

The module with every dischargeable computation's body rewritten. A computation keeps its declared type, whose row may name an instance the rewritten body no longer requests.

TYPE: QiecModule DEFAULT: field(opaque=True, extras=OPAQUE_BY_VALUE)

obstacles

One obstacle per computation whose handlers remain.

TYPE: tuple[DischargeObstacle, ...] DEFAULT: field(default=(), opaque=True, extras=OPAQUE_BY_VALUE)

rewrites

The checked rewrites actually applied, in source order.

TYPE: tuple[DischargeRewrite, ...] DEFAULT: field(default=(), opaque=True, extras=OPAQUE_BY_VALUE)

obstacle

obstacle(computation: str) -> DischargeObstacle | None

Why a computation's handlers remain.

PARAMETER DESCRIPTION
computation

The computation's name.

TYPE: str

RETURNS DESCRIPTION
DischargeObstacle or None

The obstacle, or None when the computation installs no handler after discharge.

Source code in src/quivers/qiec/discharge.py
def obstacle(self, computation: str) -> DischargeObstacle | None:
    """Why a computation's handlers remain.

    Parameters
    ----------
    computation : str
        The computation's name.

    Returns
    -------
    DischargeObstacle or None
        The obstacle, or ``None`` when the computation installs no
        handler after discharge.
    """
    return next(
        (item for item in self.obstacles if item.computation == computation), None
    )

requester

requester(request: EffectRequest) -> str | None

The handler clause a request is written in.

PARAMETER DESCRIPTION
request

A request of a discharged body.

TYPE: EffectRequest

RETURNS DESCRIPTION
str or None

clause `op` of handler `h```, orNone`` when the request is not written in a clause.

Source code in src/quivers/qiec/discharge.py
def requester(self, request: EffectRequest) -> str | None:
    """The handler clause a request is written in.

    Parameters
    ----------
    request : EffectRequest
        A request of a discharged body.

    Returns
    -------
    str or None
        ``clause `op` of handler `h```, or ``None`` when the request is
        not written in a clause.
    """
    names = {
        operation.id: operation.name
        for effect in self.module.effects
        for operation in effect.operations
    }
    for handler in self.module.handlers:
        for clause, made in clause_requests(handler, names):
            if made.origin.static_site == request.origin.static_site:
                return clause
    return None

clause_requests

clause_requests(handler: HandlerDef, names: Mapping[OperationId, str]) -> tuple[tuple[str, EffectRequest], ...]

The requests a handler's clause bodies make.

PARAMETER DESCRIPTION
handler

The handler.

TYPE: HandlerDef

names

The source name of each operation.

TYPE: Mapping[OperationId, str]

RETURNS DESCRIPTION
tuple[tuple[str, EffectRequest], ...]

Each request with the clause making it, as clause `op` of handler `h``` orthe return clause of handler `h```.

Source code in src/quivers/qiec/discharge.py
def clause_requests(
    handler: HandlerDef, names: Mapping[OperationId, str]
) -> tuple[tuple[str, EffectRequest], ...]:
    """The requests a handler's clause bodies make.

    Parameters
    ----------
    handler : HandlerDef
        The handler.
    names : Mapping[OperationId, str]
        The source name of each operation.

    Returns
    -------
    tuple[tuple[str, EffectRequest], ...]
        Each request with the clause making it, as ``clause `op` of handler
        `h``` or ``the return clause of handler `h```.
    """
    bodies: list[tuple[str, Computation | None]] = [
        (f"clause `{names[clause.operation]}`", clause.body)
        for clause in handler.clauses
    ]
    if handler.return_clause is not None:
        bodies.append(("the return clause", handler.return_clause.body))
    return tuple(
        (f"{subject} of handler `{handler.name}`", term.request)
        for subject, body in bodies
        if body is not None
        for term in _subterms(body)
        if isinstance(term, Perform)
    )

installs_handler

installs_handler(computation: NamedComputation) -> bool

Whether a computation's body installs a handler or makes an instance.

PARAMETER DESCRIPTION
computation

The computation.

TYPE: NamedComputation

RETURNS DESCRIPTION
bool

True when a handle or a local instance occurs in the body.

Source code in src/quivers/qiec/discharge.py
def installs_handler(computation: NamedComputation) -> bool:
    """Whether a computation's body installs a handler or makes an instance.

    Parameters
    ----------
    computation : NamedComputation
        The computation.

    Returns
    -------
    bool
        True when a ``handle`` or a local instance occurs in the body.
    """
    return any(
        isinstance(term, Handle | NewInstance) for term in _subterms(computation.body)
    )

discharge_computation

discharge_computation(computation: NamedComputation, module: QiecModule) -> NamedComputation | DischargeObstacle

Discharge one computation's handlers.

PARAMETER DESCRIPTION
computation

A checked computation of the module.

TYPE: NamedComputation

module

The module, whose handlers and callees are read.

TYPE: QiecModule

RETURNS DESCRIPTION
NamedComputation | DischargeObstacle

The computation with a body that installs no handler, or why its handlers remain.

Source code in src/quivers/qiec/discharge.py
def discharge_computation(
    computation: NamedComputation, module: QiecModule
) -> NamedComputation | DischargeObstacle:
    """Discharge one computation's handlers.

    Parameters
    ----------
    computation : NamedComputation
        A checked computation of the module.
    module : QiecModule
        The module, whose handlers and callees are read.

    Returns
    -------
    NamedComputation | DischargeObstacle
        The computation with a body that installs no handler, or why its
        handlers remain.
    """
    return _discharged(computation, _Tables(module))

discharge_module

discharge_module(module: QiecModule, *, evidence_passing: bool = True) -> DischargedModule

Discharge the handlers of every computation of a module.

Tail-resumptive handlers are compiled first, by evidence passing (quivers.qiec.evidence_passing.pass_evidence), which needs no continuation under any control. The handlers that remain are discharged as follows. A shared acyclic call graph or a repeated pure transition under an eligible state handler is specialized before ordinary reduction can copy the bodies. The same companion transform is available after a recursion obstacle.

PARAMETER DESCRIPTION
module

The checked module.

TYPE: QiecModule

evidence_passing

Whether tail-resumptive handlers are compiled by evidence passing. Without it every handler goes through the steps that follow, which is how the two compilations are compared.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
DischargedModule

The module itself when no computation installs a handler, else the module with every dischargeable computation rewritten and one obstacle per computation left as it is.

Source code in src/quivers/qiec/discharge.py
def discharge_module(
    module: QiecModule, *, evidence_passing: bool = True
) -> DischargedModule:
    """Discharge the handlers of every computation of a module.

    Tail-resumptive handlers are compiled first, by evidence passing
    (`quivers.qiec.evidence_passing.pass_evidence`), which needs no
    continuation under any control. The handlers that remain are
    discharged as follows. A shared acyclic call graph or a repeated pure
    transition under an eligible state handler is specialized before
    ordinary reduction can copy the bodies. The same companion transform
    is available after a recursion obstacle.

    Parameters
    ----------
    module : QiecModule
        The checked module.
    evidence_passing : bool
        Whether tail-resumptive handlers are compiled by evidence passing.
        Without it every handler goes through the steps that follow, which
        is how the two compilations are compared.

    Returns
    -------
    DischargedModule
        The module itself when no computation installs a handler, else the
        module with every dischargeable computation rewritten and one
        obstacle per computation left as it is.
    """
    return _discharge_module(
        module, share_pure_transitions=True, evidence_passing=evidence_passing
    )

Evidence passing

A tail-resumptive handler is compiled before the rewriting above: each request it answers becomes the clause's code at the request site, and each computation the request is reached through is specialized to the handler. continuation_captures lists every authored installation and every resumption a module still contains, which is empty for a module whose handlers were all tail-resumptive. The reference describes when a handler qualifies.

evidence_passing

Evidence-passing compilation of tail-resumptive handlers.

A handler clause is tail-resumptive when every path through it computes a reply without performing an effect and then resumes once, in tail position, with the handler's parameters unchanged. Such a clause never needs its continuation as a value: answering the request and resuming is the same as running the clause's code where the request was made and returning the reply [@xie2020evidently; @xie2021generalized]. A handler whose clauses are all tail-resumptive, and whose return clause makes no request, is compiled by evidence passing: the installation binds the handler's parameters once, each request it would answer becomes the clause's code inlined at the request site, and each named computation the request is reached through is specialized to that evidence, receiving the handler's parameters as extra arguments. The compiled computation installs no handler and captures no continuation, whatever its control: recursion, a case on a value known only at run time, and loops are compiled alike.

Evidence passing is the first carrier class of the representing-monad classification: the carrier is the identity, read at the handler's parameters. It keeps the reference machine's outward requests and their addresses. An inlined clause allocates no call address, as a clause activation allocates none, and its calls advance the call counter exactly as the clause's own calls do. A specialized computation is entered at the call it replaces. Its call frame carries a new name, so evidence passing specializes only computations that make no outward request, where no address can observe the frame.

EvidenceObstacle didactic-model

EvidenceObstacle(*, computation: str, reason: str, origin: SourceOrigin | None = field(default=None, opaque=True, extras=OPAQUE_BY_VALUE))

Bases: QiecModel

Why a computation's handlers are not compiled by evidence passing.

PARAMETER DESCRIPTION
computation

The computation's name.

TYPE: str

reason

The obstacle, as a clause to follow "the computation".

TYPE: str

origin

Where the obstacle is written, when the term records it.

TYPE: SourceOrigin | None DEFAULT: field(default=None, opaque=True, extras=OPAQUE_BY_VALUE)

EvidenceRewrite didactic-model

EvidenceRewrite(*, computation: ComputationId = field(opaque=True, extras=OPAQUE_BY_VALUE), handlers: tuple[HandlerId, ...] = field(opaque=True, extras=OPAQUE_BY_VALUE), companions: tuple[ComputationId, ...] = field(default=(), opaque=True, extras=OPAQUE_BY_VALUE))

Bases: QiecModel

One computation compiled by evidence passing.

PARAMETER DESCRIPTION
computation

The computation whose body was rewritten.

TYPE: ComputationId DEFAULT: field(opaque=True, extras=OPAQUE_BY_VALUE)

handlers

The handlers it installed whose requests became inlined clause code.

TYPE: tuple[HandlerId, ...] DEFAULT: field(opaque=True, extras=OPAQUE_BY_VALUE)

companions

The computations specialized to that evidence, which the rewritten body and the companions themselves call.

TYPE: tuple[ComputationId, ...] DEFAULT: field(default=(), opaque=True, extras=OPAQUE_BY_VALUE)

EvidencePassing didactic-model

EvidencePassing(*, module: QiecModule = field(opaque=True, extras=OPAQUE_BY_VALUE), rewrites: tuple[EvidenceRewrite, ...] = field(default=(), opaque=True, extras=OPAQUE_BY_VALUE), obstacles: tuple[EvidenceObstacle, ...] = field(default=(), opaque=True, extras=OPAQUE_BY_VALUE))

Bases: QiecModel

A module whose tail-resumptive handlers are compiled to direct code.

PARAMETER DESCRIPTION
module

The module with every rewritten computation replaced and every specialized companion appended.

TYPE: QiecModule DEFAULT: field(opaque=True, extras=OPAQUE_BY_VALUE)

rewrites

One record per rewritten computation, in source order.

TYPE: tuple[EvidenceRewrite, ...] DEFAULT: field(default=(), opaque=True, extras=OPAQUE_BY_VALUE)

obstacles

One record per computation that installs a tail-resumptive handler and was left as it is.

TYPE: tuple[EvidenceObstacle, ...] DEFAULT: field(default=(), opaque=True, extras=OPAQUE_BY_VALUE)

ContinuationCapture didactic-model

ContinuationCapture(*, computation: str, kind: str, handler: str = '')

Bases: QiecModel

One term of a module that can capture a continuation when it runs.

PARAMETER DESCRIPTION
computation

The name of the computation the term is written in.

TYPE: str

kind

"handle" for an installed authored handler, whose requests capture the continuation up to it, and "resume" for a resumption, which reinstates one.

TYPE: str

handler

The installed handler's name, for a "handle" capture.

TYPE: str DEFAULT: ''

evidence_obstacle

evidence_obstacle(handler: HandlerDef) -> str | None

Why a handler is not compiled by evidence passing.

PARAMETER DESCRIPTION
handler

A checked handler declaration.

TYPE: HandlerDef

RETURNS DESCRIPTION
str or None

None when the handler is authored, introduces no effect, every clause is a one-shot tail resumption that keeps the parameters, and its return clause makes no request; otherwise the first property that fails, as a clause naming the handler.

Source code in src/quivers/qiec/evidence_passing.py
def evidence_obstacle(handler: HandlerDef) -> str | None:
    """Why a handler is not compiled by evidence passing.

    Parameters
    ----------
    handler : HandlerDef
        A checked handler declaration.

    Returns
    -------
    str or None
        ``None`` when the handler is authored, introduces no effect, every
        clause is a one-shot tail resumption that keeps the parameters, and
        its return clause makes no request; otherwise the first property
        that fails, as a clause naming the handler.
    """
    if handler.implementation != "authored":
        return f"handler `{handler.name}` is foreign"
    if handler.introduced != EMPTY_ROW:
        return f"handler `{handler.name}` performs effects in its clauses"
    if _return_observes_address(handler):
        return f"the return clause of handler `{handler.name}` makes a request"
    for clause in handler.clauses:
        if clause.grade is not ResumptionGrade.LINEAR:
            return (
                f"a clause of handler `{handler.name}` has grade "
                f"{clause.grade.value}, not 1"
            )
        if clause.body is None or _tail_reply(clause.body, handler.parameters) is None:
            return (
                f"a clause of handler `{handler.name}` does not end every path "
                f"in one tail resumption that keeps its parameters"
            )
    return None

resumes_in_tail

resumes_in_tail(handler: HandlerDef) -> bool

Whether every clause resumes once, in tail position, without effects.

Unlike is_tail_resumptive, a resumption may give the handler's parameters new values, as a state handler's does.

PARAMETER DESCRIPTION
handler

A checked handler declaration.

TYPE: HandlerDef

RETURNS DESCRIPTION
bool

True when the handler is authored, introduces no effect, and every clause has grade 1 and ends every path in one tail resumption.

Source code in src/quivers/qiec/evidence_passing.py
def resumes_in_tail(handler: HandlerDef) -> bool:
    """Whether every clause resumes once, in tail position, without effects.

    Unlike `is_tail_resumptive`, a resumption may give the handler's
    parameters new values, as a state handler's does.

    Parameters
    ----------
    handler : HandlerDef
        A checked handler declaration.

    Returns
    -------
    bool
        True when the handler is authored, introduces no effect, and every
        clause has grade 1 and ends every path in one tail resumption.
    """
    return (
        handler.implementation == "authored"
        and handler.introduced == EMPTY_ROW
        and all(
            clause.grade is ResumptionGrade.LINEAR
            and clause.body is not None
            and _tail_reply(clause.body, None) is not None
            for clause in handler.clauses
        )
    )

is_tail_resumptive

is_tail_resumptive(handler: HandlerDef) -> bool

Whether a handler is compiled by evidence passing.

PARAMETER DESCRIPTION
handler

A checked handler declaration.

TYPE: HandlerDef

RETURNS DESCRIPTION
bool

True when evidence_obstacle finds nothing.

Source code in src/quivers/qiec/evidence_passing.py
def is_tail_resumptive(handler: HandlerDef) -> bool:
    """Whether a handler is compiled by evidence passing.

    Parameters
    ----------
    handler : HandlerDef
        A checked handler declaration.

    Returns
    -------
    bool
        True when `evidence_obstacle` finds nothing.
    """
    return evidence_obstacle(handler) is None

pass_evidence

pass_evidence(module: QiecModule) -> EvidencePassing

Compile every tail-resumptive handler of a module by evidence passing.

Each computation that installs a tail-resumptive handler is compiled as a whole: every such installation becomes bound parameters and inlined clause code, and other installations stay. A computation for which some request, call, or function value cannot be compiled is left as it is, with the reason.

PARAMETER DESCRIPTION
module

The checked module.

TYPE: QiecModule

RETURNS DESCRIPTION
EvidencePassing

The compiled module, the rewrites, and the obstacles.

Source code in src/quivers/qiec/evidence_passing.py
def pass_evidence(module: QiecModule) -> EvidencePassing:
    """Compile every tail-resumptive handler of a module by evidence passing.

    Each computation that installs a tail-resumptive handler is compiled
    as a whole: every such installation becomes bound parameters and
    inlined clause code, and other installations stay. A computation for
    which some request, call, or function value cannot be compiled is left
    as it is, with the reason.

    Parameters
    ----------
    module : QiecModule
        The checked module.

    Returns
    -------
    EvidencePassing
        The compiled module, the rewrites, and the obstacles.
    """
    handlers = {item.id: item for item in module.handlers}
    compiler = _Compiler(module)
    computations: list[NamedComputation] = []
    rewrites: list[EvidenceRewrite] = []
    obstacles: list[EvidenceObstacle] = []
    for computation in module.computations:
        if not _installs_tail_resumptive(computation, handlers):
            computations.append(computation)
            continue
        before = len(compiler.companions)
        specialized = dict(compiler.specialized)
        try:
            compiled = compiler.compile(computation)
        except _NotPassable as error:
            del compiler.companions[before:]
            compiler.specialized = specialized
            compiler.pending.clear()
            obstacles.append(
                EvidenceObstacle(
                    computation=computation.name,
                    reason=error.reason,
                    origin=error.origin,
                )
            )
            computations.append(computation)
            continue
        computations.append(compiled)
        installed = tuple(
            dict.fromkeys(
                item.handler
                for item in _installations(computation.body)
                if is_tail_resumptive(handlers[item.handler])
            )
        )
        rewrites.append(
            EvidenceRewrite(
                computation=computation.id,
                handlers=installed,
                companions=tuple(item.id for item in compiler.companions[before:]),
            )
        )
    if not rewrites:
        return EvidencePassing(module=module, obstacles=tuple(obstacles))
    return EvidencePassing(
        module=module.with_(computations=(*computations, *compiler.companions)),
        rewrites=tuple(rewrites),
        obstacles=tuple(obstacles),
    )

continuation_captures

continuation_captures(module: QiecModule) -> tuple[ContinuationCapture, ...]

Every term of a module's computations that can capture a continuation.

A request captures the continuation up to the authored handler that answers it, and a resumption reinstates one. A module with no authored installation and no resumption in any computation captures none: every request it makes is answered by a foreign provider or leaves the module, and every clause it runs is inlined code.

PARAMETER DESCRIPTION
module

The module.

TYPE: QiecModule

RETURNS DESCRIPTION
tuple[ContinuationCapture, ...]

One record per authored installation and per resumption, in computation order.

Source code in src/quivers/qiec/evidence_passing.py
def continuation_captures(module: QiecModule) -> tuple[ContinuationCapture, ...]:
    """Every term of a module's computations that can capture a continuation.

    A request captures the continuation up to the authored handler that
    answers it, and a resumption reinstates one. A module with no
    authored installation and no resumption in any computation captures
    none: every request it makes is answered by a foreign provider or
    leaves the module, and every clause it runs is inlined code.

    Parameters
    ----------
    module : QiecModule
        The module.

    Returns
    -------
    tuple[ContinuationCapture, ...]
        One record per authored installation and per resumption, in
        computation order.
    """
    handlers = {item.id: item for item in module.handlers}
    found: list[ContinuationCapture] = []
    for computation in module.computations:
        for item in _descendants(computation.body):
            if isinstance(item, Handle):
                handler = handlers[item.handler]
                if handler.implementation == "authored":
                    found.append(
                        ContinuationCapture(
                            computation=computation.name,
                            kind="handle",
                            handler=handler.name,
                        )
                    )
            elif isinstance(item, Resume):
                found.append(
                    ContinuationCapture(computation=computation.name, kind="resume")
                )
    return tuple(found)