-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a migration guide #1048
Comments
Collecting some notes as I go: unsafeToFuture()import cats.effect.implicits._
def beforeF[F[_]: Effect, A](fa: F[A]): Future[A] = fa.ioIO.unsafeToFuture()
// Note: Using a `Dispatcher` resource is cheap - don't worry about it
def preferredAfterF[F[_]: Async, A](fa: F[A]): F[Future[A]] = Dispatcher[F].use(_.unsafeToFuture(fa))
// Note: It's not certain whether dispatcher passed implicitly will be the canonical style, or whether it will be explicit argument instead
def ifNeededAfterF[F[_], A](fa: F[A])(implicit D: Dispatcher[F]): Future[A] = d.unsafeToFuture(fa)
def beforeIO[A](ioa: IO[A]): Future[A] = ioa.unsafeToFuture()
def afterIO[A](ioa: IO[A]): IO[Future[A]] = Dispatcher[IO].use(_.unsafeToFuture(ioa))
def ifNeededAfterIO(ioa: IO[A])(implicit D: Dispatcher[IO]): Future[A] = D.unsafeToFuture(ioa) unsafeRunSync()import cats.effect.implicits._
def beforeF[F[_]: Effect, A](fa: F[A]): A = fa.ioIO.unsafeRunSync()
// Avoid this pattern; instead wrap both the `unsafeRunSync` call *and* the thing that needs it, so that it can be contained within the scope of a `Dispatcher[F].use(...)` block.
def ifNeededAfter[F[_], A)(fa: F[A])(implicit D: Dispatcher[F]): A = D.unsafeRunSync(fa)
def beforeIO[A](ioa: IO[A]): A = ioa.unsafeRunSync()
def afterIO[A](ioa: IO[A]): A = ioa.unsafeRunSync() Async.fromFuturedef futureApi(): Future[Int]
def before[F[_]: Async: ContextShift]: F[Int] = Async.fromFuture(Sync[F].delay(futureApi()))
def after[F[_]: Async]: F[Int] = Async[F].fromFuture(Sync[F].delay(futureApi())) Async.asyncdef intCallback(cb: Either[Throwable, Int] => Unit): Unit
def before[F[_]: Async]: F[Int] = F.async[Int](cb => intCallback(cb))
// Note: 'async_', not 'async' - the 'async_' version preserves the old signature
def after[F[_]: Async]: F[Int] = F.async_[Int](cb => intCallback(cb)) TestContext// before; libraryDependencies on cats-effect-laws
import cats.effect.laws.util.TestContext
// after; libraryDependencies on cats-effect-testkit
import cats.effect.testkit.TestContext |
just some ideas for now, I can expand them later. There's plenty left in the readme too: ContextShift -> Async |
|
If nobody beats me to it, I'll take this one of these days and make something structured. Note to self: start with the new artifacts. |
The heading and first sentence are always the hardest part |
Progress so far: #1687 |
We need to document all the changes we've made in operational terms, so that people know what new type class to use, what functions moved around, what semantics are new can old (especially this!), etc etc. Basically everything you need to know to upgrade to 3.0.
The text was updated successfully, but these errors were encountered: