Skip to content

Commit 085c9da

Browse files
authored
Add a note for flattenValue (#7176)
To note that order of entries in the result of `flattenValue` will be reversed order of entries in underlying data of original `Value`.
1 parent 8c201d1 commit 085c9da

File tree

1 file changed

+4
-1
lines changed
  • plutus-ledger-api/src/PlutusLedgerApi/V1

1 file changed

+4
-1
lines changed

plutus-ledger-api/src/PlutusLedgerApi/V1/Value.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,10 @@ unionWith f ls rs =
426426

427427
-- | Convert a 'Value' to a simple list, keeping only the non-zero amounts.
428428
-- Note that the result isn't sorted, meaning @v1 == v2@ doesn't generally imply
429-
-- @flattenValue v1 == flattenValue v2@.
429+
-- @flattenValue v1 == flattenValue v2@. Additionally, the entries in the
430+
-- result are listed in reverse order of the underlying data of the original ‘Value’.
431+
-- For instance, the lovelace entry which ordinarily appears first in the ‘Value’
432+
-- will appear last in the result.
430433
-- Also assumes that there are no duplicate keys in the 'Value' 'Map'.
431434
flattenValue :: Value -> [(CurrencySymbol, TokenName, Integer)]
432435
flattenValue v = goOuter [] (Map.toList $ getValue v)

0 commit comments

Comments
 (0)