I'm looking for the most elegant implementation of
import scalaz.zio.Task
def combineTasks[A, B, C, D](task1: Task[Option[A]],
task2: Task[Option[B]],
task3: Task[Option[C]])
(f: (A, B, C) => D)
: Task[Option[D]]
using
- no additional dependencies
scalaz-zio-interop-catsandcatsscalaz-zio-interop-scalaz7xandscalaz7x
The solutions should generalize well to n arguments.
After getting some help and doing research, I found the following implementations, that seem the most elegant to me so far:
1. Using no additional dependencies:
2. Using
scalaz-zio-interop-catsandcats:See mapN over composed Apply for a related discussion.
3. Using
scalaz-zio-interop-scalaz7xandscalaz7x: