avocado

package avocado

Type members

Classlikes

trait AvocADO[F[_]]

Value members

Concrete methods

inline def ado[F[_], A](inline comp: F[A])(using ap: AvocADO[F]): F[A]

Transforms the provided for-comprehension to it's parallel version. Example usage:

Transforms the provided for-comprehension to it's parallel version. Example usage:

ado {
 for {
   a <- doStuff1
   b <- doStuff2(a)
   c <- doStuff3
   d <- doStuff4(a)
 } yield combine(a, b, c, d)
}

The above code will be transformed to code essentially equivalent to:

for {
 a <- doStuff1
 (b, c, d) <- doStuff2(a).zip(doStuff3).zip(doStuff4(a))
} yield combine(a, b, c, d)

The transformed code will use the provided implicit avocado.AvocADO instance for method calls such as map, flatMap and zip. Potential for paralellizm is introduced in places where zip calls are used. So in order to utilize this method in a sensible way, avocado.AvocADO.zip should initialize parallel calls. Though this method should also be safe for sequential operations.