github zio/zio v1.0.0-RC19
1.0.0-RC19

latest releases: v2.1.1, v2.1.0, v2.1.0-RC5...
4 years ago

Another packed release! This version features tons of improvements to existing data types and exciting changes to ZIO Streams. Read on for more details!

A note on our roadmap

Although we've promised that RC18 would be the last (or one-before-last) release before the mythical 1.0.0 release, we've seen some regressions caused by the supervision changes introduced in RC18.

We have an exciting refinement to the model coming up in the following weeks. It is not included in this release, but will be included in the next one. Therefore, we anticipate that after RC19, we will release between 1-2 additional versions: one containing the supervision refinement, and optionally another release with follow-ups.

We appreciate your patience and help in using ZIO and sending feedback and bug reports!

Notable changes

ZIO Core

In this release a foldAll combinator has been added to ZRef that allows transforming a Ref by "zooming in" on one field in a case class or data structure. This allows Ref and friends to function as concurrent optics. A separate ZIO Optics library will be released in the near future with tools for doing this and ways to lift optics from existing libraries to work with ZRef.

ZIO Streams

This release features a major re-design to the ZIO Streams module:

  • All ZStream operators now work on chunks. Previously, to work with chunked streams, one would need to use ZStreamChunk. That data type is now deleted and instead all operators benefit from chunking automatically.

  • ZSink has been radically simplified.

    The previous implementation featured leftovers: a property made it possible to use ZSink as a streaming parser. We've come to realize that any parser implemented using ZSink's combinators is probably slow and inefficient compared to an actual parser library. Moreover, we would never be able to match the performance of parsing libraries while maintaining ZSink's generality.

    Instead, we've decided to re-focus ZSink on modeling aggregations and accumulations. It is now more limited, but more efficient and easier to use: the purpose of ZSink is to process a stream and emit one final result.

    If you've been using ZSink for aggregations (using ZSink.foldLeft and other operators), you should see little change to your code. In some cases, operators that were previously sinks have been migrated to ZTransducer - see next bullet point.

    For actual parsing usecases, stay tuned to the github.com/zio/zio-codecs project. Some exciting developments are in work there!

  • ZTransducer has been added to accomodate aggregations that emit multiple results.

    Whereas ZSink's purpose is to return one final result when processing a stream, there are several usecases where it makes sense to process a stream and emit multiple results. For example - collecting elements into batches of a certain size; weighted folds; etc.

    For these purposes, ZTransducer should now be used.

Big thanks to @regiskuckaertz and @simpadjo for their work on this re-design!

  • Add termination strategies for ZStream#merge (#3543) (by @luis3m)
  • Add ZStream#interruptAfter and ZStream#haltAfter (#3534) (by @luis3m)
  • Modify ZStream.fromQueue to no longer use singleton chunks (#3571) (by @luis3m)
  • Modify ZStream#toIterator to use chunks (#3569) (by @luis3m)
  • Add Transducer#zip (#3551) (by @simpadjo)
  • Implement ZStream#intersperse (#3514) (by @fagossa)
  • Fix ZStream.toInputStream handling of signed bytes (#3546) (by @lancelet)
  • add ZTransducer#mapOutput (#3523) (by @simpadjo)
  • Add ZTransducer.splitOn (#3519) (by @regiskuckaertz)
  • Add ZSink#mapError (#3501) (by @simpadjo)
  • Redesign ZStream as the ZConduit hierarchy (#3079) (by @iravid)
  • Add ZStream#haltWhen(IO) and ZStream#interruptWhen(IO) (#3306) (by @jeremyrsmith)
  • Add ZStream.fromIterator versions that capture exceptions. (#3195) (by @alexknvl)
  • ZStream error refinement. (#3196) (by @alexknvl)
  • Added drop and skip constructors. (#3190) (by @alexknvl)
  • Added ZStream.fromInputStreamEffect and ZStream.fromInputStreamManaged. (#3198) (by @alexknvl)

ZIO Test

In this release the implementation of TestClock has been updated. The concept of fiberTime has been eliminated. As a result, methods such as currentTime will always return the time that is set by the user using methods such as setTime. In addition, adjust will now suspend until all scheduled tasks have been completed. This should eliminate the need for external coordination such as promises and queues in most cases.

Don't miss a new zio release

NewReleases is sending notifications on new releases.