Warning: Use forA_ Found: forA (same issue with mapA)
App Development3 posts680 views3 likesLast activity May 2020
ME
meetOP
May 2020nonconsuming NetSecurityObligations: ()
with
fundId: Text
investor: Party
settlementDate: Date
settlementObligations: [ContractId SettlementObligation]
do
forA settlementObligations (\obligationCid -> do
obligation <- fetch obligationCid
assert (obligation.investor == investor && obligation.fundId == fundId))
return ()
The forA statement gives me the following warning -
Warning: Use forA_
Found:
forA
settlementObligations
(\ obligationCid
-> do obligation <- fetch obligationCid
assert
((DA.Internal.Record.getField @"investor" obligation) == investor
&& (DA.Internal.Record.getField @"fundId" obligation) == fundId))
Perhaps:
forA_
settlementObligations
(\ obligationCid
-> do obligation <- fetch obligationCid
assert
((DA.Internal.Record.getField @"investor" obligation) == investor
&& (DA.Internal.Record.getField @"fundId" obligation) == fundId))
Warning: Use forA_
Found:
forA
settlementObligations
(\ obligationCid
-> do obligation <- fetch obligationCid
assert
((DA.Internal.Record.getField @"investor" obligation) == investor
&& (DA.Internal.Record.getField @"fundId" obligation) == fundId))
Perhaps:
forA_
settlementObligations
(\ obligationCid
-> do obligation <- fetch obligationCid
assert
((DA.Internal.Record.getField @"investor" obligation) == investor
&& (DA.Internal.Record.getField @"fundId" obligation) == fundId))
Warning changes to a Variable not in scope: forA_ error upon changing it to the following as per the suggestion -
do
forA_ settlementObligations (\obligationCid -> do
obligation <- fetch obligationCid
assert (obligation.investor == investor && obligation.fundId == fundId))
Face the same warning with mapA as well - not sure I understand why.
CO
cocreature
May 2020forA_ and mapA_ are in DA.Foldable so you have to import that. The linter sadly does not tell you that atm. There is an open issue for this at Linter recommends functions that don't exist · Issue #3767 · digital-asset/daml · GitHub. So to be specific, add
import DA.Foldable
at the beginning and you can access mapA_ and forA_.
ME
meet
May 2020Thanks @cocreature!