Hey all,
So I was looking at something recently and wanted to take on some advice because it was a little awkward, and i'm not really that happy with how it worked out. Imagine there are two 3rd party service calls that are executed in Future blocks (they are akka futures), and I want to validate the results of those service calls, before using the results of said validation to execute another function in the success case. This "end" function must not be executed if the validation failed.
Of course, lifting my functions that do validation into the future means that I end up with multiple Future[Validation[A,B]], and then loose out on the convenience of being able to short-circuit the computation (other than on a future completing in a failed state) or aggregate the validation results. I could implement traverse for Future and convert Future[Validation[A,B]] into Validation[A, Future[B]], but that would require me to block as far as i can see it, and i'd rather not block if possible.
Hope that makes some sense; does anyone else have a similar situation they've resolved this cleanly for?
Cheers, Tim