I have a choice defined as:
MyChoice: ( ContractId X, ContractId X )
....
return ( a, b )
How do I use a
or b
in a scenario as an argument for something else? Dot notation doesn't appear to work.
I have a choice defined as:
MyChoice: ( ContractId X, ContractId X )
....
return ( a, b )
How do I use a
or b
in a scenario as an argument for something else? Dot notation doesn't appear to work.
You can use ._1
and ._2
as accessors; or you can use fst
and snd
as functions to extract the elements.
You can also bind the components of a pair using pattern matching when the choice is exercised, like so:
somecode = do
(x,y) <- exercise myCid MyChoice with ...
doStuffWith x
doStuffWIth y