Extract, inline, change signature, and move
Use structural refactorings with clear inputs, outputs, and conflict limits.
On this page
Extract an expression#
In the order workshop, select unit_price * quantity and use Refactor → Extract → Variable. Name it subtotal. The generated binding should preserve evaluation order and replace the selected expression.
For a function extraction, select complete expressions:
subtotal = price * quantity
tax = div(subtotal, 10)
Use Extract → Method and review inferred inputs and outputs. When later code uses both bindings, the extracted private function can return a tuple whose values are rebound at the call site. Inspect that contract before applying.
Inline with evaluation in mind#
Use Inline on a simple binding such as subtotal. Parentheses and precedence must remain correct. Repeating an effectful expression such as an HTTP call is not equivalent to reusing its computed result; unsupported or unsafe inlining is rejected rather than duplicated automatically.
Extraction from guards, patterns, quoted code, or selections that change evaluation order can report conflicts. Reduce the selection or restructure the code explicitly before retrying.
Change a simple fixed-arity signature#
Invoke Change Signature on a supported function. The dialog uses one parameter per line. Reorder existing names, write old -> new to rename one, or add new = 0 to supply a literal call-site value. Inspect specs, direct calls, pipes, and captures.
Defaults, pattern parameters, behaviour/protocol contracts, delegates, dynamic dispatch, and some expression captures are outside the supported signature-change cases. A conflict identifies where the transformation cannot be guaranteed; it is not an invitation to accept a partial rewrite.
Move a module#
Move Module supports a single-module source file into an existing project directory and can adjust its module name and references. It does not overwrite an existing target. Inspect aliases, file path, namespace, and usages together, then run tests. Multiple/nested module declarations may need manual separation first.
Manual for version 2026.1.15 · Reviewed