From [Update Party] to [Party]

Hi,

I iterate from a series of contracts that fetch using the map function and create a set of Parties from all the contract loaded. I then want to create a set of those parties.

However, the result of my map is a [Update Party] which I can’t do a union with a Set Party.

What is the usual pattern for that?

2 Likes

If you use mapA, you’ll get an Update [Party]. You can then use do notation to extract out the list, and from there convert it into a Set. Finally, you can union that Set Party with whatever else you need to.

It’ll look something like this:

operation contractIds = do
  contracts <- mapA fetch contractIds
  parties <- mapA getPartySomehow contracts
  -- use `parties` here
5 Likes

thanks for that @SamirTalwar!!!

1 Like