I want to make first call in seq to next ones but then next 10 calls parallel to each other using Scala's futures. I dont want to program map flatmaps or for inside for comprehensions as they'll add on to unreadibility. Is it possible with one for comprehension.
reference code:
val fcaAndFplAccountDetails = getFcaAndFplAccount(fplId)
def orgDetailsIO(orgId:Int) = getOrgDetails(orgId)
def unbilledTxns(orgid: Int) = getUnbilledTxns(orgId)
for {
accDetails <- fcaAndFplAccountDetails
orgDetails <- orgDetailsIO(accDetails.orgId)
unbilledTxns <- unbilledTxnsIO(accDetails.orgId)
... other calls that depend on org id
} yield { ... further computations }
Can the calls after fcaAndFplAccountDetails be parallelized within the comprehension?