I often write the following, intuitively thinking that it should work:
forA_ list $ submit party do createCmd
This throws the error:
Couldn't match type ‘Commands (ContractId t0)’ with ‘Script b0’
Expected type: MyListTemplate -> Script b0
Actual type: MyListTemplate
-> Commands (ContractId t0)
I’ve meanwhile found out what it should be, and I think I understood why that is:
submit party do forA_ list createCmd
But could someone ELI5 (explain like I’m 5) why the former approach doesn’t work?
EDIT:
I suppose the confusing thing is that this actually does work:
forA_ list (\c -> submit party do createCmd c)
So why is submit party do createCmd
not the same as \c -> submit party do createCmd c
in this case?