Skip to content

[Chore] Extract shared term constructors into Transform.Lib#7774

Open
Unisay wants to merge 1 commit intomasterfrom
yura/uplc-term-builders
Open

[Chore] Extract shared term constructors into Transform.Lib#7774
Unisay wants to merge 1 commit intomasterfrom
yura/uplc-term-builders

Conversation

@Unisay
Copy link
Copy Markdown
Contributor

@Unisay Unisay commented May 8, 2026

Preparatory refactor before changing CSE tests in a follow-up PR.

Transform.Inline.Spec already had a section of UPLC term-construction helpers (var, lam, app, delay, case_, builtin, addInteger).

  • Lift them into a shared Transform.Lib module reusable across other test specs in the same testlib.
  • Make Simplifier Spec use these helpers.

@Unisay Unisay force-pushed the yura/uplc-term-builders branch from 1088be1 to cb93062 Compare May 8, 2026 13:08
@Unisay Unisay self-assigned this May 8, 2026
@Unisay Unisay added the No Changelog Required Add this to skip the Changelog Check label May 8, 2026
@Unisay Unisay force-pushed the yura/uplc-term-builders branch from cb93062 to 17bf5d4 Compare May 8, 2026 13:13
Move helpers (`var`, `lam`, `app`, `delay`, `case_`, `builtin`,
`addInteger`) from `Transform.Inline.Spec` into a new shared
`Transform.Lib` module, extend with `force`, `con`, `err`, `headList`,
`ite`, `true`, `false`, `constr`, and a `T` alias for
`Term Name DefaultUni DefaultFun ()`.

Migrate `Transform.Simplify.Spec` to use these helpers throughout,
replacing inline `LamAbs ()` / `Apply ()` / `Force ()` / `Delay ()` /
`Var ()` / `Builtin ()` / `Error ()` / `mkConstant @integer ()` /
`Constr ()` / `Case () _ (V.fromList _)` constructors and per-test
`plus`/`con` duplicates. Inline trivial `let one = con 1` /
`two = con 2` / `three = con 3` bindings.

Local bindings that shadowed top-level helpers are renamed to
semantic identifiers describing their role (`dupLam`, `forceAddLam`,
`applyLam`, `delayLam`, `trueBranch`, `falseBranch`).

No behaviour change; all goldens unchanged.
@Unisay Unisay force-pushed the yura/uplc-term-builders branch from 17bf5d4 to 6426ff9 Compare May 8, 2026 13:18
@Unisay Unisay changed the title [uplc] Extract shared term constructors into Transform.Lib [Chore] Extract shared term constructors into Transform.Lib May 8, 2026
@Unisay Unisay requested review from a team and zeme-wana May 8, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No Changelog Required Add this to skip the Changelog Check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant