You can unify both cats-effect-2 and cats-effect-3 modules into a single "cats" module (doesn't actually need cats-effect, and opens the usage to a lot more datatypes than just effect types). Something like :
package avocado.instances
import avocado.AvocADO
import cats.Monad
import cats.Parallel
object cats {
given [F[_]: Monad Parallel] : AvocADO[F] = new AvocADO[F] {
def pure[A](a: A): F[A] = Monad[F].pure(a)
def map[A, B](fa: F[A], f: A => B): F[B] = Monad[F].map(fa)(f)
def zip[A, B](fa: F[A], fb: F[B]): F[(A, B)] = Parallel.parTuple2(fa, fb)
def flatMap[A, B](fa: F[A], f: A => F[B]): F[B] = Monad[F].flatMap(fa)(f)
}
}
This will work for both cats-effect-2 and cats-effect3, and only needs the dependency to cats-core. Moreover, it'll give users access to the ado block in contexts such as Either/Validated, where errors would automatically be aggregated in a data structure.
You can unify both
cats-effect-2andcats-effect-3modules into a single "cats" module (doesn't actually need cats-effect, and opens the usage to a lot more datatypes than just effect types). Something like :This will work for both cats-effect-2 and cats-effect3, and only needs the dependency to cats-core. Moreover, it'll give users access to the
adoblock in contexts such as Either/Validated, where errors would automatically be aggregated in a data structure.