You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
listOfIndices <- pletC $ pconstant [1,3,5]
txInputs <- pletC txInfo.inputs
results <- pletC $ pmap # plam (\i -> pelemAt # i # txInputs) # listOfIndices
Couldn't match type ‘PBuiltinList PTxInInfo’ with ‘PTxInInfo’
arising from a use of ‘plam’
• In the second argument of ‘(#)’, namely
‘plam (\ i -> pelemAt # i # txInputs)’
In the first argument of ‘(#)’, namely
‘pmap # plam (\ i -> pelemAt # i # txInputs)’
In the second argument of ‘($)’, namely
‘pmap # plam (\ i -> pelemAt # i # txInputs)
# listOfIndices’
From a user perspective, there are many ways to work around this issue. Namely, by adding a haskell level type annotation to txInputs like so txInputs :: Term s (PBuiltinList PTxInInfo) <- pletC txInfo.inputs
or by explicitly matching against an element of txInputs at the plutarch level type prior to using pmap on txInputs like so, PTxInInfo indexedInput <- pmatchC (pelemAt # someIdx # txInputs)
It can compile with the type annotations / explicit pmatching on an element, but it does not compile without it. Without the type annotations it incorrectly determines that txInput is a single PTxInInfo as opposed to a PBuiltinList with elements of type PTxInInfo.
The text was updated successfully, but these errors were encountered:
This is the HasField instance basically breaking Haskell with incoherent instances. We should just remove the incoherent instances, since the behaviour is confusing, and less necessary now after #521
From a user perspective, there are many ways to work around this issue. Namely, by adding a haskell level type annotation to txInputs like so
txInputs :: Term s (PBuiltinList PTxInInfo) <- pletC txInfo.inputs
or by explicitly matching against an element of txInputs at the plutarch level type prior to using pmap on txInputs like so,
PTxInInfo indexedInput <- pmatchC (pelemAt # someIdx # txInputs)
It can compile with the type annotations / explicit pmatching on an element, but it does not compile without it. Without the type annotations it incorrectly determines that txInput is a single PTxInInfo as opposed to a PBuiltinList with elements of type PTxInInfo.
The text was updated successfully, but these errors were encountered: