From abbf6205f929fa44cfff4a647178b6714a2eaf7a Mon Sep 17 00:00:00 2001 From: Felix Bruckmeier Date: Mon, 29 Mar 2021 17:24:47 +0200 Subject: [PATCH] Delete replaced code --- .../util/effect/RerunnableInstances.scala | 62 +------------------ 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/effect/src/main/scala/io/catbird/util/effect/RerunnableInstances.scala b/effect/src/main/scala/io/catbird/util/effect/RerunnableInstances.scala index 28d27c25..df6ff12e 100644 --- a/effect/src/main/scala/io/catbird/util/effect/RerunnableInstances.scala +++ b/effect/src/main/scala/io/catbird/util/effect/RerunnableInstances.scala @@ -1,13 +1,13 @@ package io.catbird.util.effect import cats.effect.Clock +import cats.effect.kernel.{ MonadCancel, Outcome, Sync } import com.twitter.util.{ Future, Monitor } import io.catbird.util.{ Rerunnable, RerunnableMonadError } import java.lang.Throwable import java.util.concurrent.TimeUnit import java.lang.System -import cats.effect.kernel.{ MonadCancel, Outcome, Sync } import scala.Unit import scala.concurrent.duration.FiniteDuration @@ -50,64 +50,4 @@ trait RerunnableInstances { } } } - - /* - implicit final val rerunnableEffectInstance: Effect[Rerunnable] = - new RerunnableMonadError { // with Effect[Rerunnable] { - final def suspend[A](thunk: => Rerunnable[A]): Rerunnable[A] = Rerunnable.suspend[A](thunk) - - //override final def delay[A](thunk: => A): Rerunnable[A] = Rerunnable[A](thunk) - - final def async[A](k: (Either[Throwable, A] => Unit) => Unit): Rerunnable[A] = - new Rerunnable[A] { - final def run: Future[A] = { - val promise = new Promise[A] - - k { e => - if (promise.isDefined) () - else - e match { - case Right(a) => promise.setValue(a) - case Left(err) => promise.setException(err) - } - } - - promise - } - } - - final def asyncF[A](k: (Either[Throwable, A] => Unit) => Rerunnable[Unit]): Rerunnable[A] = - new Rerunnable[A] { - final def run: Future[A] = { - val promise = new Promise[A] - - val rerunnable = k { e => - if (promise.isDefined) () - else - e match { - case Right(a) => promise.setValue(a) - case Left(err) => promise.setException(err) - } - } - - rerunnable.run.flatMap(_ => promise) - } - } - -// final def runAsync[A](fa: Rerunnable[A])(cb: Either[Throwable, A] => IO[Unit]): SyncIO[Unit] = -// rerunnableToIO[A](fa).runAsync(cb) - - final def bracketCase[A, B](acquire: Rerunnable[A])(use: A => Rerunnable[B])( - release: (A, ExitCase) => Rerunnable[Unit] - ): Rerunnable[B] = new Rerunnable[B] { - final def run: Future[B] = - acquire.run.flatMap { a => - val future = use(a).run - future.transform(result => - release(a, tryToExitCase(result)).run.handle(Monitor.catcher).flatMap(_ => future) - ) - } - } - } - */ }