Couldn't find any mention of this in the issue tracker, so apologies if it has been discussed before!
Currently the following syntax methods are defined:
final class ParallelApOps[M[_], A](private val ma: M[A]) extends AnyVal {
def &>[B](mb: M[B])(implicit P: Parallel[M]): M[B] =
P.parProductR(ma)(mb)
def <&[B](mb: M[B])(implicit P: Parallel[M]): M[A] =
P.parProductL(ma)(mb)
def parProductL[B](mb: M[B])(implicit P: Parallel[M]): M[A] =
P.parProductL(ma)(mb)
def parProductR[B](mb: M[B])(implicit P: Parallel[M]): M[B] =
P.parProductR(ma)(mb)
def parProduct[B](mb: M[B])(implicit P: Parallel[M]): M[(A, B)] =
Parallel.parProduct(ma, mb)
def parReplicateA(n: Int)(implicit P: Parallel[M]): M[List[A]] =
Parallel.parReplicateA(n, ma)
}
final class ParallelApplyOps[M[_], A, B](private val mab: M[A => B]) extends AnyVal {
def <&>(ma: M[A])(implicit P: Parallel[M]): M[B] =
Parallel.parAp(mab)(ma)(P)
def parAp(ma: M[A])(implicit P: Parallel[M]): M[B] =
Parallel.parAp(mab)(ma)
}
However, parProductR, and parProductL, parProduct and parAp only require NonEmptyParallel, so the above should be:
final class ParallelApOps[M[_], A](private val ma: M[A]) extends AnyVal {
def &>[B](mb: M[B])(implicit P: NonEmptyParallel[M]): M[B] =
P.parProductR(ma)(mb)
def <&[B](mb: M[B])(implicit P: NonEmptyParallel[M]): M[A] =
P.parProductL(ma)(mb)
def parProductL[B](mb: M[B])(implicit P: NonEmptyParallel[M]): M[A] =
P.parProductL(ma)(mb)
def parProductR[B](mb: M[B])(implicit P: NonEmptyParallel[M]): M[B] =
P.parProductR(ma)(mb)
def parProduct[B](mb: M[B])(implicit P: NonEmptyParallel[M]): M[(A, B)] =
Parallel.parProduct(ma, mb)
def parReplicateA(n: Int)(implicit P: Parallel[M]): M[List[A]] =
Parallel.parReplicateA(n, ma)
}
final class ParallelApplyOps[M[_], A, B](private val mab: M[A => B]) extends AnyVal {
def <&>(ma: M[A])(implicit P: NonEmptyParallel[M]): M[B] =
Parallel.parAp(mab)(ma)(P)
def parAp(ma: M[A])(implicit P: NonEmptyParallel[M]): M[B] =
Parallel.parAp(mab)(ma)
}
This change would break binary compatibility, so would probably have to go in cats 3?
Couldn't find any mention of this in the issue tracker, so apologies if it has been discussed before!
Currently the following syntax methods are defined:
However,
parProductR, andparProductL,parProductandparAponly requireNonEmptyParallel, so the above should be:This change would break binary compatibility, so would probably have to go in cats 3?