Dhall — 106 Operations for AI Agents
This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Dhall code through the act MCP server. 106 operations available: 32 refactor, 18 query, 42 analysis, 14 verification. Each operation is callable from Claude Code, Cursor, Codex, OpenCode, or any MCP-compatible agent host. Click any operation for a stable anchor link suitable for citation.
Worked Dhall examples
act101 applies Dhall-specific fixes and generation directly to a .dhall file: it can generate a record type let binding with named fields, convert an if-then-else expression on a Bool into the equivalent merge expression, add an inline type annotation to an existing let binding, and generate a let binding that imports a package from a URL, an environment variable, or a local path. It also renames a union type everywhere it is declared and referenced, and deletes a let binding whose name never appears elsewhere in the file. A Dhall program is a single expression, and in every example here that expression is either a chain of let bindings ending in in or, as with the if-then-else-to-merge conversion, the bare expression on its own. Each example below is the verbatim output of the command shown, run against the file shown.
Generate a record type binding
config.dhall is a bare expression with no type bindings of its own.
$ act refactor-lang generate_record_type --file config.dhall --params '{"type_name":"Config","fields":[{"name":"host","type":"Text"},{"name":"port","type":"Natural"},{"name":"debug","type":"Bool"}],"line":1,"column":1}'
Before
42
After
let Config = { host : Text, port : Natural, debug : Bool }
42
A let Config = { host : Text, port : Natural, debug : Bool } binding is prepended above the expression, ready to be edited into the real shape.
Convert an if-then-else to a merge expression
choice.dhall is the single expression if True then "yes" else "no".
$ act refactor-lang convert_if_then_else_to_merge --file choice.dhall --params '{"line":1,"column":1}'
Before
if True then "yes" else "no"
After
merge { True = "yes", False = "no" } True
The conditional becomes merge { True = "yes", False = "no" } True — both branches are now cases of a union match on the same Bool value, rather than an if-expression.
Add a type signature to a binding
double.dhall binds double to a lambda, \(n : Natural) -> n + n, with no type annotation on the binding itself.
$ act refactor-lang generate_signature --file double.dhall --params '{"binding_name":"double","type_annotation":"Natural -> Natural","line":1,"column":1}'
Before
let double = \(n : Natural) -> n + n
in double 5
After
let double : Natural -> Natural = \(n : Natural) -> n + n
in double 5
let double = ... becomes let double : Natural -> Natural = ...; the lambda body and the double 5 call after it are unchanged.
Generate an import binding for a remote package
imports.dhall is a bare expression with no imports of its own.
$ act refactor-lang generate_import_statement --file imports.dhall --params '{"import_name":"Prelude","import_path":"https://prelude.dhall-lang.org/v21.1.0/package.dhall","line":1,"column":1}'
Before
42
After
let Prelude = https://prelude.dhall-lang.org/v21.1.0/package.dhall
42
A let Prelude = https://prelude.dhall-lang.org/v21.1.0/package.dhall binding is added above the expression, which is left unchanged.
Rename a union type and its references
shape.dhall declares Shape as the tagged union < Circle | Square > and then annotates s : Shape and builds it with Shape.Circle.
$ act refactor-lang rename_type --file shape.dhall --params '{"old_name":"Shape","new_name":"Form","line":1,"column":5}'
Before
let Shape = < Circle | Square >
let s : Shape = Shape.Circle
in s
After
let Form = < Circle | Square >
let s : Form = Form.Circle
in s
All three occurrences of Shape — the declaration, the s : Shape annotation, and the Shape.Circle case — become Form.
Remove an unused let binding
totals.dhall binds unused to 42 alongside result as dead weight; only result is ever referenced.
$ act refactor-lang remove_unused_binding --file totals.dhall --params '{"binding_name":"unused","line":1,"column":1}'
Before
let unused = 42
let result = "hello"
in result
After
let result = "hello"
in result
The let unused = 42 binding is deleted as dead code; the result binding and the final in result are unchanged.
Query
18 query tools, the same on every supported language. Descriptions live in the shared reference: /docs/query-tools.
callers control_flow data_flow definition diagnostics effect_closure effect_summary fix_auto get_type graph import_organize interface mutations references repo_outline skeleton symbols symbols_batch
Refactor
| Operation | Description |
|---|---|
add-missing-record-field |
Add a missing required field to a record literal |
add-null-guard |
Wrap Optional variable access with a merge-based null guard |
add-type-annotation |
Add explicit type annotation to a let binding |
convert-function-to-lambda |
Convert named function to lambda expression |
convert-if-then-else-to-merge |
Convert if-then-else to merge expression |
convert-lambda-to-function |
Convert lambda expression to named function |
extract-binding |
Extract expression into new let binding |
extract-function |
Extract expression into named function with parameters |
extract-type |
Extract type expression into type alias |
extract_function |
Extract a code selection into a new function — automatically infers parameters, return types, and inserts the call site. Use instead of manually cutting/pasting code. Works without LSP; LSP improves type inference. Params: file (string), new_name (string), start_line (u32), start_column (u32), end_line (u32), end_column (u32) [, preview (bool), receipt (bool)] |
extract_variable |
Extract an expression into a named variable — inserts the declaration and replaces the expression with the variable name. Works without LSP. Params: file (string), new_name (string), start_line (u32), start_column (u32), end_line (u32), end_column (u32) [, preview (bool)] |
generate-function-from-signature |
Generate function stub from type signature |
generate-import-statement |
Generate import for external module |
generate-record-type |
Generate record type from record values |
generate-signature |
Generate type annotation for binding |
generate-type-alias |
Generate type alias from repeated type expression |
generate-union-type |
Generate union type from literal cases |
inline |
Inline a variable, function, or method — replace every usage with its definition body, then remove the original. The inverse of extract. Works without LSP (single-file); LSP enables cross-file inlining. Params: file (string), symbol (string) [, line (u32), preview (bool), receipt (bool)] |
inline-function |
Inline function body at call sites and remove definition |
inline-variable |
Inline let binding at all uses and remove binding |
insert_body |
Replace a function's implementation body with new code. AST-validated — rejects if the result has parse errors, so you can't accidentally break syntax. Use instead of manual text editing for function rewrites. Params: file (string), symbol (string), code (string) [, commit (bool)] |
move-binding-to-top |
Move let binding to top of scope |
move_symbol |
Move a function, class, or type to a different file and automatically update all imports across the codebase. Use instead of manually cut/paste + fixing imports. Works without LSP (single-file); LSP enables cross-file import updates. Params: file (string), symbol (string), destination (string) [, preview (bool), receipt (bool)] |
promote-binding-to-top-level |
Move let binding to file top level |
recipe_run |
Run a codemod recipe: declarative match → transform → optional verify across modeled grammars. Preview lists matches; apply writes with optional E7 receipts and all-or-nothing rollback. Returns a per-site report. |
remove-unused-binding |
Remove let binding that is never referenced |
remove-unused-import |
Remove import not used in file |
rename |
Rename a symbol and automatically update ALL references across the codebase. Safer and faster than find-and-replace — AST-aware, won't rename strings or comments. Works without LSP (single-file); LSP enables cross-file renames. Params: file (string), old_name (string), new_name (string) [, line (u32), column (u32), preview (bool), receipt (bool)] |
rename-identifier |
Rename variable, function, type, or record field across all references |
rename-type |
Rename type alias or record type definition |
reorganize-imports |
Sort and group import statements |
simplify-conditional |
Simplify if-then-else with known boolean condition |
Analysis
42 analysis tools, the same on every supported language. Descriptions live in the shared reference: /docs/analysis-tools.
analyze_api_diff analyze_chokepoints analyze_clones analyze_clusters analyze_cohesion analyze_conformance analyze_coupling analyze_cycle_risk analyze_cycles analyze_dead_code analyze_depth analyze_entry_points analyze_export analyze_extraction analyze_fan_balance analyze_features analyze_hotspots analyze_impact analyze_inconsistencies analyze_inheritance analyze_interface_bloat analyze_interfaces analyze_layers analyze_orphan_types analyze_patterns analyze_platform_deps analyze_readiness analyze_roles analyze_seams analyze_stability analyze_surface analyze_test_gaps analyze_thickness analyze_type_completeness churn_hotspots co_change_clusters coverage_overlay ownership_map profile_overlay simulate split_module trace_overlay
Verify
14 verify tools, the same on every supported language. Descriptions live in the shared reference: /docs/verification.
bisect_regression gate generate_test_harness scan secret_surface summarize_pr taint_flow unsafe_surface verify_behavioral_equivalence verify_contract_preserved verify_diff_semantics verify_port_parity verify_side_effects verify_test_impact