I’m looking to refine my choice logic, to make it more elegant and hopefully a little more performant.
For the choice in question, we take in a list of product details, we need to process those details to create
Product contracts for each, and the perform secondary logic to update the instance of
ProductOwner with relevant Product information.
The intention was to do something like the below:
let processProductInformation(productInfo: ProductInformation) = do ... let newProduct = Product with ... return newProduct let updateProductOwner(newProduct: Product) = do ... create ProductOwner with ... let newProducts = map processProductInformation productsInfo newProductOwners <- mapA updateProductOwner newProducts newProductCids <- mapA create newProducts return newProductCids
But I seem to have gone wrong with those last two lines, I’m trying to have the choice return
[ContractId Product] but not certain exactly what’s needed to get there.
Any advice would be greatly appreciated!