iniyanp
5/24/2017 - 6:30 PM

Sequence and NonDeterminism

Sequence and NonDeterminism

//To convert List[Task[String]] to Task[List[String]] sequentially.
val t:Task[String] = Task.now("4")
val listT:List[Task[String]] = List(t)
val result:Task[List[String]] = listT.sequence

result.run

//To convert the same in parallel.

Nondeterminism[Task].gatherUnordered(listT)