github zio/zio v2.0.0-RC6
2.0.0-RC6

latest releases: v2.1.0-RC5, v2.1.0-RC4, v2.1.0-RC3...
2 years ago

Given the changes since RC5, we are doing one more release candidate for ZIO 2.0. This release candidate brings the following changes.

Autoblocking

Blocking work will now automatically be identified and shifted to the blocking executor. You can continue to use operators like blocking to give a "hint" to the runtime that a particular operator is blocking for efficiency but this should no longer be needed for correctness. This is a new feature and a significant innovation so please report any issues!

Simplification Of Runtime Customization

The RuntimeConfig and RuntimeConfigAspect data types have been deleted. Instead, you can customize the runtime using layers. This allows you to use ZIO workflows in setting up your runtime, for example to load some configuration information using ZIO Config.

If you need to access information about the current configuration you can use more specialized operators such as ZIO.logger or ZIO.executor.

If you want to customize the runtime you can use basic layers defined in the Runtime companion object such as addLogger or ZIO ecosystem libraries will provide their own layers that do all necessary setup. The layer in ZIOApp has been renamed bootstrap to more clearly indicate this.

Other Simplifications

The type alias "companion objects" have been deleted. So instead of Task.attempt(???) do ZIO.attempt(???). This promotes consistency and is one less thing to think about.

Variants of acquireRelease on the ZIO trait have been deleted in favor of the versions on the ZIO companion object. So instead of acquire.acquireReleaseWith(release)(use) do ZIO.acquireReleaseWith(acquire)(release)(use). This is more idiomatic as constructors belong on the companion object and promotes consistency between different ways of using resources.

The Accessible trait has been deleted. This proved a relatively unpopular alternative to implementing accessors compared to just using the macro annotation in Scala 2 or defining them manually, which has become easier with automatic completion tools. We are continuing to explore solutions for replacing macro annotations on Scala 3.

The Spec data type has been simplified to "build in" the TestFailure data type. So if you ever did layer.mapError(TestFailure.fail) in your tests before you can delete that.

The provideService operator has also been deleted. Instead of provideService(service) do provideLayer(ZLayer.succeed(service)). Layers are the idiomatic way of providing ZIO workflows with their dependencies and this operator generally should not be needed anymore with the elimination of the default services from the environment.

Don't miss a new zio release

NewReleases is sending notifications on new releases.