From f8150d939b0dc8f9a74a8446ced1b75195bc5120 Mon Sep 17 00:00:00 2001 From: Denys Fakhritdinov Date: Mon, 29 Jan 2024 17:17:40 +0100 Subject: [PATCH] bump cats-effect to 3.5 --- .../catshelper/FromFuture.scala | 28 +++++++++++++------ project/Dependencies.scala | 4 +-- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/core/src/main/scala/com/evolutiongaming/catshelper/FromFuture.scala b/core/src/main/scala/com/evolutiongaming/catshelper/FromFuture.scala index d6107d99..8d073dae 100644 --- a/core/src/main/scala/com/evolutiongaming/catshelper/FromFuture.scala +++ b/core/src/main/scala/com/evolutiongaming/catshelper/FromFuture.scala @@ -39,9 +39,14 @@ object FromFuture { for { future <- Sync[F].delay(future) result <- future.value.fold { - Async[F].async_[A] { callback => - future.onComplete { a => - callback(a.toEither) + Async[F].async[A] { callback => + Async[F].delay { + future.onComplete { a => + callback(a.toEither) + } + // immitates semantic _before_ v3.5 + // https://github.com/typelevel/cats-effect/releases/tag/v3.5.0 + Async[F].unit.some } } } { @@ -62,10 +67,15 @@ object FromFuture { executor <- Async[F].executionContext future <- Sync[F].delay(future) result <- future.value.fold { - Async[F].async_[A] { callback => - future.onComplete { a => - callback(a.toEither) - }(executor) + Async[F].async[A] { callback => + Async[F].delay { + future.onComplete { a => + callback(a.toEither) + }(executor) + // immitates semantic _before_ v3.5 + // https://github.com/typelevel/cats-effect/releases/tag/v3.5.0 + Async[F].unit.some + } } } { case Success(a) => Async[F].pure(a) @@ -79,8 +89,8 @@ object FromFuture { def functionK[F[_]: FromFuture]: FunctionK[Future, F] = new FunctionK[Future, F] { - def apply[A](fa: Future[A]) = FromFuture.summon[F].apply(fa) - } + def apply[A](fa: Future[A]) = FromFuture.summon[F].apply(fa) + } implicit val futureFromFuture: FromFuture[Future] = new FromFuture[Future] { def apply[A](future: => Future[A]) = future diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 7624c9cc..ae6fc669 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -10,12 +10,12 @@ object Dependencies { } object Cats { - private val version = "2.9.0" + private val version = "2.10.0" val core = "org.typelevel" %% "cats-core" % version val kernel = "org.typelevel" %% "cats-kernel" % version val macros = "org.typelevel" %% "cats-macros" % version - private val effectVersion = "3.4.8" + private val effectVersion = "3.5.3" val effect = "org.typelevel" %% "cats-effect" % effectVersion val effectLaws = "org.typelevel" %% "cats-effect-laws" % effectVersion val effectTestkit = "org.typelevel" %% "cats-effect-testkit" % effectVersion