Skip to content
Discussions/App Development/"Used tuple of size > 5!"... but where?Forum ↗

"Used tuple of size > 5!"... but where?

App Development3 posts343 viewsLast activity Jan 2023
WA
WallaceKellyOP
Jan 2023

If you daml build the daml-finance-app, you get the following warning:

File:     src/daml/Daml/Finance/Setup/Scenario/OtcSwaps.daml
Hidden:   no
Range:    24:1-24:4
Source:   Core to Daml-LF
Severity: DsWarning
Message:  Used tuple of size > 5! Daml only has Show, Eq, Ord instances for tuples of size <= 5.

I understand the issue and the fact that the Show type class is only defined for up to five-element tuples.

What I cannot figure out is why does OtcSwaps.daml trigger this warning?

I see tuples…

  • of size two ("Public", singleton public), ("USD", cashRoute), etc…
  • of size three (ty, tm, td)

…but nothing of size > 5.

GA
Gary_Verhaegen
Jan 2023

Hi @WallaceKelly,

You’ll have to wait for a compiler engineer to confirm, but my suspicion is that line 28:

    all@[operator, public, centralBank, seller, buyer] = map (.id) parties

generates a large tuple as part of its desugaring, and the warning is based on the desugared code representation rather than the actual code.

This is supported by the fact that breaking down that line into (with an appropriate import DA.List ((!!), head)):

    all = map (.id) parties
    operator = head all
    public = all !! 1
    centralBank = all !! 2
    seller = all !! 3
    buyer = all !! 4

gets rid of the warning, at least for me.

CO
cocreature
Jan 2023

This is a bug. It has already been fixed in 2.5.0. For some reason the finance app was still stuck on an older snapshot. Upgraded in Upgrade to 2.5.0 by cocreature · Pull Request #82 · digital-asset/daml-finance-app · GitHub

← Back to Discussions