You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add proven-safe whole-workspace refactors between ordinary fn and lazy effect fn.
This must not be implemented as a keyword toggle: ordinary statements execute eagerly, while invoking an effect function delays its entire body. An ordinary function may intentionally perform eager setup and return an effect {} recipe.
Scope
Add compiler-owned refactor.rewrite actions for eligible ordinary/effect functions.
Update the declaration kind and complete contract.
Insert or remove run at semantically corresponding direct call sites.
Validate callable annotations and first-class callable uses.
Preserve ownership, capture access, eager/lazy timing, and trap behavior.
Return one atomic multi-file change plan or refuse the action with the first untransformable use.
Resolve against a complete, current workspace revision.
Keep intentionally behavior-changing conversion separate from safe refactoring.
Safety constraints
Conversion must be withheld when it would change or cannot prove preservation of:
eager setup timing;
trap timing;
effect construction/run layering;
ownership or affine cleanup;
capture access/repeatability;
callable identity or first-class callable types;
public contract semantics;
any call site outside the complete editable workspace set.
Lint behavior
Integrate with #181 only for patterns proven semantics-preserving and enabled by policy. Do not emit a universal “could be an effect function” or “could be ordinary” warning based on textual shape.
If intentionally behavior-changing conversion is later desired, expose it as a separately named previewed action rather than an ordinary safe refactor.
Acceptance criteria
Eligible direct-call conversions rewrite declaration and call sites atomically.
Ordinary functions with meaningful eager setup are not presented as safely convertible.
Effect functions with failures/requirements or effectful behavior are converted only when the target ordinary form preserves the contract and behavior.
First-class callable uses are either rewritten with preserved types or block the action with an explanation.
Partial/stale/uneditable workspace state prevents a partial refactor.
Tests cover direct calls, run, returned effect recipes, traps, captures, affine values, callbacks, aliases, public functions, and recursive call graphs.
Summary
Add proven-safe whole-workspace refactors between ordinary
fnand lazyeffect fn.This must not be implemented as a keyword toggle: ordinary statements execute eagerly, while invoking an effect function delays its entire body. An ordinary function may intentionally perform eager setup and return an
effect {}recipe.Scope
refactor.rewriteactions for eligible ordinary/effect functions.runat semantically corresponding direct call sites.Safety constraints
Conversion must be withheld when it would change or cannot prove preservation of:
Lint behavior
Integrate with #181 only for patterns proven semantics-preserving and enabled by policy. Do not emit a universal “could be an effect function” or “could be ordinary” warning based on textual shape.
If intentionally behavior-changing conversion is later desired, expose it as a separately named previewed action rather than an ordinary safe refactor.
Acceptance criteria
run, returned effect recipes, traps, captures, affine values, callbacks, aliases, public functions, and recursive call graphs.Dependencies