Skip to content

Re-export the full Value API from V2/V3 and the Data.* modules#7839

Merged
Unisay merged 4 commits into
masterfrom
yura/value-umbrella-reexports
Jul 14, 2026
Merged

Re-export the full Value API from V2/V3 and the Data.* modules#7839
Unisay merged 4 commits into
masterfrom
yura/value-umbrella-reexports

Conversation

@Unisay

@Unisay Unisay commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

PlutusLedgerApi.V2, PlutusLedgerApi.V3, and PlutusLedgerApi.Data.V1/V2/V3 now re-export the full Value API that PlutusLedgerApi.V1 already exposed, and all six umbrellas (including V1) additionally expose geq, gt, leq, lt, and withCurrencySymbol, which previously lived only in PlutusLedgerApi.V1.Value/.Data.Value. Reading or comparing a Value from a version umbrella no longer needs a direct PlutusLedgerApi.V1.Value or PlutusLedgerApi.V1.Data.Value import. Every V2/V3 module in this repo that reached into those V1 modules now uses the umbrella instead; the remaining direct importers are genuine V1 code (the V1 doc examples, the script-contexts V1 variant) and the V1 Value test suites.

@Unisay Unisay self-assigned this Jul 10, 2026
@Unisay
Unisay requested a review from Copilot July 10, 2026 12:07
@Unisay
Unisay marked this pull request as ready for review July 10, 2026 12:10
@Unisay
Unisay requested review from a team and SeungheonOh July 10, 2026 12:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the “umbrella” ledger API modules (PlutusLedgerApi.V2, PlutusLedgerApi.V3, and PlutusLedgerApi.Data.V1/V2/V3) to re-export the same Value-related surface area that PlutusLedgerApi.V1 already provides, so downstream users don’t need extra V1.Value / V1.Data.Value imports for common accessors and helpers.

Changes:

  • Re-export the full Value accessor/helper API (e.g. valueOf, lovelaceValueOf, unsafeLovelaceValueOf, flattenValue, AssetClass helpers) from V2, V3, and Data.V* umbrella modules.
  • Remove now-redundant downstream imports that became unused under -Werror=unused-imports.
  • Add a changelog fragment documenting the re-export expansion.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
plutus-ledger-api/src/PlutusLedgerApi/V2.hs Extends V2 umbrella exports to include the full Value API re-exported from V1.
plutus-ledger-api/src/PlutusLedgerApi/V3.hs Extends V3 umbrella exports to include the full Value API re-exported from V2.
plutus-ledger-api/src/PlutusLedgerApi/Data/V1.hs Extends Data.V1 umbrella exports to include the full Value API from V1.Data.Value.
plutus-ledger-api/src/PlutusLedgerApi/Data/V2.hs Extends Data.V2 umbrella exports to include the full Value API re-exported from Data.V1.
plutus-ledger-api/src/PlutusLedgerApi/Data/V3.hs Extends Data.V3 umbrella exports to include the full Value API re-exported from Data.V2.
plutus-ledger-api/changelog.d/20260710_100000_yuriy.lazaryev_value_umbrella_reexports.md Changelog entry documenting the expanded umbrella-module re-exports.
plutus-benchmark/script-contexts/src/PlutusBenchmark/V1/Data/ScriptContexts.hs Drops redundant PlutusLedgerApi.V1.Data.Value import now covered by PlutusLedgerApi.Data.V1.
plutus-benchmark/script-contexts/src/PlutusBenchmark/V2/Data/ScriptContexts.hs Drops redundant PlutusLedgerApi.V1.Data.Value import now covered by PlutusLedgerApi.Data.V2.
plutus-benchmark/cardano-loans/src/CardanoLoans/Validator.hs Drops redundant PlutusLedgerApi.V1.Value (valueOf) import now covered by PlutusLedgerApi.V3.

@zliu41 zliu41 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are more cleanups to be done, e.g., the PlutusLedgerApi.V1.Value import here should be replaced by PlutusLedgerApi.V3, since it is a V3 script.

@Unisay

Unisay commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Done — swept the repo for the same pattern. The modules that still needed withCurrencySymbol/geq/leq were the reason those names weren't re-exported at all, so I added geq/gt/leq/lt/withCurrencySymbol to the V1/V2/V3 and Data.V1/V2/V3 umbrellas too; now the only direct PlutusLedgerApi.V1.Value importers left are genuine V1 code and the V1 Value tests. plinth-template: IntersectMBO/plinth-template#80 (draft, blocked on this PR merging plus a plutus bump there).

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.6.3

🚀 View preview at
https://IntersectMBO.github.io/plutus/pr-preview/docs/pr-7839/

Built to branch gh-pages at 2026-07-13 17:38 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Base automatically changed from yura/issue-2304-positional-lovelace to master July 13, 2026 17:08
Unisay added 4 commits July 13, 2026 19:10
PlutusLedgerApi.V2, V3, and Data.V1/V2/V3 now re-export the same Value API that
PlutusLedgerApi.V1 already exposed: the read accessors (valueOf, lovelaceValueOf,
unsafeLovelaceValueOf, currencySymbolValueOf, assetClassValueOf), the AssetClass
type and its constructors, and the helpers flattenValue, symbols, isZero, split,
scale, lovelaceValue, currencySymbol, tokenName. Previously these umbrella
modules exposed only the Value type and a few constructors, so reading a value
from a V2/V3 or Data.* context needed a separate import from V1.Value or
V1.Data.Value. There is no per-version Value type (V2 re-exports V1.Value, V3
re-exports V2.Value, and the Data.* chain mirrors that), so the accessors apply
unchanged.

Widening the re-exports made three explicit imports redundant under
-Werror=unused-imports; removed them: import ...V1.Value (valueOf) in
cardano-loans, and the whole-module ...V1.Data.Value imports in script-contexts
V1.Data and V2.Data ScriptContexts.

Stacked on the unsafeLovelaceValueOf branch (#7838), which adds the accessor
this widening re-exports.
@Unisay
Unisay force-pushed the yura/value-umbrella-reexports branch from e3f9302 to 57a983f Compare July 13, 2026 17:11
@Unisay
Unisay merged commit e3af90a into master Jul 14, 2026
14 checks passed
@Unisay
Unisay deleted the yura/value-umbrella-reexports branch July 14, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants