v3.7.0-RC1
This is the fifty-ninth release in the Cats Effect 3.x lineage. It is fully binary compatible with every 3.x release and intended to be fully source-compatible with the 3.7.x lineage. While we always strive to avoid making breaking changes between release candidate and final versions, in some cases it cannot be avoided and no strong guarantees are provided.
What's Changed
This is a relatively smaller minor release jump relative to 3.6.x since it contains a major and long-anticipated enhancement: support for Scala Native 0.5, including full multithreading on LLVM! This has been a very long time coming, and we've been planning how to provide this support and planting the seeds for several years now. As noted in previous release notes, the integrated runtime released in 3.6.0 provides the basic building blocks for true, practically usable multithreaded asynchronous I/O on LLVM, and this release finally brings all of those pieces to fruition.
Full support has been implemented for epoll and kqueue, and we intend to extend this support to io_uring in the future. These polling systems have been significantly upgraded and enhanced since 3.6.x in order to support the same sort of thread coordination that has been present on the JVM from the beginning.
Of course, the largest piece of this is the WorkStealingThreadPool itself. This was ported from JVM-only to cross-build entirely on both JVM and LLVM targets. Surprisingly, almost no changes were required to make this possible! It is a testament to the thought and effort which went into Scala Native 0.5 that this port was dramatically smoother and less complex than anyone could have reasonably predicted. While we did run into a few minor issues with Scala Native, only one major problem with its multithreading support was encountered, and it only applies in a very niche scenario which was easily worked around.
We really cannot stress enough how impressed we are with Scala Center and Virtus' work on this front. Scala Native 0.5 is quite the triumph, and Cats Effect 3.7 is the proof. Going forward, you should essentially expect rough parity between scheduling functionality on JVM and LLVM, with JavaScript now being the unusual one (due to its single-threaded nature).
As an aside, it's worth noting that this parity holds despite the fact that Scala Native actually implements subtly different memory publication semantics than the JVM in some very specific circumstances. The Cats Effect concurrency state model (i.e. Ref/Deferred) is such that these semantic differences are entirely invisible in userspace, while the performance benefits are present regardless. This is one example of the careful planning and coordination which went into this release spanning across many people and multiple projects.
The one area in which Cats Effect on Scala Native meaningfully lags behind the JVM is fiber tracing. This functionality should exist on LLVM, but it appears that the APIs do not work correctly at runtime. It is expected that these bugs will be resolved in a future Scala Native release, at which point we'll be able to enable the functionality in Cats Effect.
Enhancements
- Add
SecureRandominstance toSyncIOcompanion by @qxrein in https://github.com/typelevel/cats-effect/pull/4324 - Add
realTimeZonedDateTimetoClockJVM extensions by @mmienko in https://github.com/typelevel/cats-effect/pull/4316 - Add support for Native multithreaded execution by @durban in https://github.com/typelevel/cats-effect/pull/4201
blockingandinterruptibleon Scala Native by @djspiewak in https://github.com/typelevel/cats-effect/pull/4378- Add
awaitEventto expose the full featureset of kqueue by @rahulrangers in https://github.com/typelevel/cats-effect/pull/4423 - Add IORuntime#liveFiberSnapshot by @iRevive in https://github.com/typelevel/cats-effect/pull/4444
- Add a TestConsole by @morgen-peschke in https://github.com/typelevel/cats-effect/pull/4394
- Add NonEmptyHotswap by @morgen-peschke in https://github.com/typelevel/cats-effect/pull/4267
- Add
KeyedMutexby @BalmungSan in https://github.com/typelevel/cats-effect/pull/4065 - Add
IOLocal#asLocal[F[_]]:Local[F,A]by @NthPortal in https://github.com/typelevel/cats-effect/pull/4438
Bug Fixes
- Don't expose private WSTP type in method signature by @armanbilge in https://github.com/typelevel/cats-effect/pull/4290
- Make
IOFiber#{_join,_cancel}volatile on Native by @durban in https://github.com/typelevel/cats-effect/pull/4400 - Removed
IORuntimeBuilder#addPolleron Scala.js by @djspiewak in https://github.com/typelevel/cats-effect/pull/4419- As a brief callout, this change actually represents a binary-breaking change relative to Cats Effect 3.6.x on Scala.js! We almost universally avoid doing this, but in this case the type signature exposure was entirely accidental and the method never worked, so anyone who wrote code which called that method on Scala.js would have simply had broken code. For this reason, we felt justified in the binary break.
- Make the heap in
TimerHeapvolatile on native by @armanbilge in https://github.com/typelevel/cats-effect/pull/4443 - Fix wstp shutdown interrupt (3.x edition) by @djspiewak in https://github.com/typelevel/cats-effect/pull/4344
- Use
_exitinstead of System.exit in fatal cases by @djspiewak in https://github.com/typelevel/cats-effect/pull/4428 - Fix source compatibility with Scala 3.6 by @mbovel in https://github.com/typelevel/cats-effect/pull/4381
Documentation
- docs: provide an example on how to collect fiber dump programmatically by @iRevive in https://github.com/typelevel/cats-effect/pull/4399
- code snippet typo in faq.md by @combinatorist in https://github.com/typelevel/cats-effect/pull/4395
- Fix typo in documentation of function tryOfferN of QueueSink and PQueueSink. by @nmichael44 in https://github.com/typelevel/cats-effect/pull/4384
- Change tutorial CopyFile object name by @davidsalter in https://github.com/typelevel/cats-effect/pull/4458
Behind the Scenes
- Update scala-library to 2.13.16 in series/3.x by @typelevel-steward[bot] in https://github.com/typelevel/cats-effect/pull/4239
- Update sbt-scalajs, scalajs-compiler, ... to 1.18.2 in series/3.x by @typelevel-steward[bot] in https://github.com/typelevel/cats-effect/pull/4249
- Revert documentation format changes by @mzuehlke in https://github.com/typelevel/cats-effect/pull/4246
- Update scala3-library, ... to 3.3.5 in series/3.x by @typelevel-steward[bot] in https://github.com/typelevel/cats-effect/pull/4261
- Replace specs2 with munit by @iRevive in https://github.com/typelevel/cats-effect/pull/4216
- Update scalafmt-core to 3.9.4 in series/3.x by @typelevel-steward[bot] in https://github.com/typelevel/cats-effect/pull/4297
- Replace deprecated commands in build.sbt by @iRevive in https://github.com/typelevel/cats-effect/pull/4339
- Update cats-core, cats-free, ... to 2.13.0 in series/3.x by @typelevel-steward[bot] in https://github.com/typelevel/cats-effect/pull/4356
- Update sbt-scalafix to 0.14.3 in series/3.x by @typelevel-steward[bot] in https://github.com/typelevel/cats-effect/pull/4403
- Update sbt-typelevel to 0.8.0 in series/3.x by @typelevel-steward[bot] in https://github.com/typelevel/cats-effect/pull/4417
- Update sbt, scripted-plugin to 1.11.3 in series/3.x by @typelevel-steward[bot] in https://github.com/typelevel/cats-effect/pull/4427
- flake.lock: Update by @typelevel-steward[bot] in https://github.com/typelevel/cats-effect/pull/4414
- Update sbt-mdoc to 2.7.2 in series/3.x by @typelevel-steward[bot] in https://github.com/typelevel/cats-effect/pull/4441
- SN 0.5.6 -> 0.5.7 -> 0.5.8 by @durban in https://github.com/typelevel/cats-effect/pull/4362
New Contributors
- @mmienko made their first contribution in https://github.com/typelevel/cats-effect/pull/4316
- @mbovel made their first contribution in https://github.com/typelevel/cats-effect/pull/4381
- @combinatorist made their first contribution in https://github.com/typelevel/cats-effect/pull/4395
- @nmichael44 made their first contribution in https://github.com/typelevel/cats-effect/pull/4384
- @NthPortal made their first contribution in https://github.com/typelevel/cats-effect/pull/4438
- @morgen-peschke made their first contribution in https://github.com/typelevel/cats-effect/pull/4394
- @davidsalter made their first contribution in https://github.com/typelevel/cats-effect/pull/4458
Full Changelog: https://github.com/typelevel/cats-effect/compare/v3.6.3...v3.7.0-RC1