Releases: zio/zio
1.0.0-RC19-2
1.0.0-RC19-1
ZIO 1.0.0-RC19-1 contains a few bugfixes for changes shipped in 1.0.0-RC19. It should be binary/source compatible with 1.0.0-RC19.
Notable changes:
- ZStream bugfixes (#3633) (by @iravid)
- ZStream.toInputSteram: add
close(#3613) (by @simpadjo) - Support withFilter in ZStream (#3631) (by @paulpdaniels)
- Implement Chunk#partitionMap (#3601) (by @adamgfraser)
- implement memoize (#3593) (by @adamgfraser)
- Optimize ZStream#toInputStream (#3599) (by @simpadjo)
- Add ZStream#debounce (#3580) (by @luis3m)
1.0.0-RC19
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.
- implement retry (#3566) (by @adamgfraser)
- Add ZIO.tupled (#3565) (by @luis3m)
- Redesign ZManaged around an embedded ReleaseMap (#3510) (by @iravid)
- Add someOrElse to ZSTM, ZIO and ZManaged (#3560) (by valenterry)
- Add Schedule noDelay and run (#3554) (by @reibitto)
- Explore Initial Encoding of ZLayer (#3483) (by @adamgfraser)
- Add Operators (#3541) (by @adamgfraser)
- Add ZQueue.takeBetween (#3520) (by @mijicd)
- Synchronize Tag typeclass naming with izumi-reflect, rename Tagged->Tag, deprecate old names (#3508) (by @neko-kai)
- improve reentrant lock performance (#3099) (by @unclebob418)
- Add NonEmptyChunk constructors (#3517) (by @simpadjo)
- implement ZLayer#tapError (#3505) (by @adamgfraser)
- Add ZIO#filterNot and ZSTM#filterNot (#3477) (by @taeguk)
- Use ChunkBuilder more prominently in Chunk (#3453) (by @mschuwalow)
- Implement ZManaged#useNow (#3466) (by @adamgfraser)
- Implement ZManaged#flattenM (#3464) (by @adamgfraser)
- Implement ZIO#service (#3422) (by @adamgfraser)
- Add specialized accessor operations to Chunk (#3431) (by @whysoserious)
- Scala.js upgrade to v1.0.0 (#2392) (#2479) (by @lvitaly)
- Back up Chunk[Boolean] by Chunk.BitChunks (#3419) (by @whysoserious)
- Optimize TQueue (#3421) (by @mijicd)
- Add alternative combinator to ZSTM (#3414) (by @mijicd)
- implement ZLayer#launch (#3415) (by @adamgfraser)
- Improve TArray's performance (#3407) (by @mijicd)
- Implement ZIO#mapEffect (#3404) (by @adamgfraser)
- Implement ZRefM (#3391) (by @adamgfraser)
- Boost TMap performance (#3382) (by @mijicd)
- Improve Support for NonEmptyChunk (#3374) (by @adamgfraser)
- Add support for setting Random seed (#3367) (by @reibitto)
- drop implicit CanFail constraint from stm orElse combinator (and related ones) (#3370) (by @swachter)
- implement variants for other ZIO effect types (#3351) (by @adamgfraser)
- Make Chunk Extend IndexedSeq (#3342) (by @adamgfraser)
- Improve TMap's performance (#3343) (by @mijicd)
- Implement BitChunk (#3318) (by @adamgfraser)
- implement orElseOptional (#3339) (by @adamgfraser)
- Bring Chunk to (Z)STM (#3345) (by @mijicd)
- Improve TMap transformations (#3340) (by @mijicd)
- Implement Optics for ZRef (#3258) (by @adamgfraser)
- Improve Error Messages with Has (#3319) (by @adamgfraser)
- implement corresponds (#3320) (by @adamgfraser)
- Performance on Chunk.apply (#3297) (by @ahoy-jon)
- implement convenience methods (#3313) (by @adamgfraser)
- Optimize unsafe ZQueue methods (#3274) (by @mijicd)
- Prototype for NonEmptyChunk (#3241) (by @ahoy-jon)
- implement unwrap (#3267) (by @adamgfraser)
- add andTo and >+> to ZLayer (#3269) (by @felher)
- Introduce ZTRef (#3266) (by @vasilmkd)
- Improve fiber dump output (#3192) (by @simpadjo)
- core: Add
unless/unlessMas dual ofwhen/whenM(#3259) (by @sirthias) - Add *WithTrace variants for error handling combinators (#3145) (by @mvv)
- implement envs and properties (#3244) (by @adamgfraser)
- implement isFailure and isSuccess (#3228) (by @adamgfraser)
- JS Promise interop (#3163) (by @vasilmkd)
- implement ++ (#3224) (by @adamgfraser)
- implement fromDuration (#3221) (by @adamgfraser)
- Check if queue is empty before polling (#3222) (by @mijicd)
- Improve ZQueue performance (#3216) (by @mijicd)
- implement dimap (#3209) (by @adamgfraser)
- ZIO Core: Implement Cause#stripDefects (#3206) (by @adamgfraser)
- Prevent retry storms on ZSTM (#3210) (by @mijicd)
- ZIO Core: Disconnect Children in Uninterruptible Race (#3125) (by @adamgfraser)
- Add managed option combinators (#3186) (by @paulpdaniels)
- Add operator alias for
andThenEither(#3185) (by @ioleo) - implement forkAs (#3131) (by @adamgfraser)
- Implement ZIO#collectAll_ (#3148) (by @adamgfraser)
- Implement Random#between (#3149) (by @adamgfraser)
- fix randomDelay (#3147) (by @adamgfraser)
- Add STM aliases (#3129) (by @mijicd)
- ZIO Core: Add Named Aliases for ZLayer Operators (#3116) (by @adamgfraser)
- Port reject/rejectM to ZManaged (#3109) (by @vpavkin)
ZIO Streams
This release features a major re-design to the ZIO Streams module:
-
All
ZStreamoperators now work on chunks. Previously, to work with chunked streams, one would need to useZStreamChunk. That data type is now deleted and instead all operators benefit from chunking automatically. -
ZSinkhas been radically simplified.The previous implementation featured leftovers: a property made it possible to use
ZSinkas a streaming parser. We've come to realize that any parser implemented usingZSink'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 maintainingZSink's generality.Instead, we've decided to re-focus
ZSinkon modeling aggregations and accumulations. It is now more limited, but more efficient and easier to use: the purpose ofZSinkis to process a stream and emit one final result.If you've been using
ZSinkfor aggregations (usingZSink.foldLeftand other operators), you should see little change to your code. In some cases, operators that were previously sinks have been migrated toZTransducer- 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!
-
ZTransducerhas 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,
ZTransducershould 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)andZStream#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.
- ZIO Test: Make TestClock Run Effects In Order (#3424) (by @adamgfraser)
- ZIO Test: Improve Ergonomics of Laws for Higher Kinded Types (#3356) (by @adamgfraser)
- Fix handling of zero probability values in Gen.weighted (#3544) (by @felher)
- check bounds (#3532) (by @adamgfraser)
- ZIO Test: Improve Management of Resources in Specs (#3456) (by @adamgfraser)
- ZIO Test: Support Laws for Capabilities Parameterized on Two Types (#3420) (by @adamgfraser)
- Add AssertionM for effectfull assertions (#3403) (by @senia-psm)
- ZIO Test: Support Laws for Higher Kinded Types (#3326) (by @adamgfraser)
- implement generators for chunks (#3321) (by @adamgfraser)
- implement advance (#3304) (by @adamgfraser)
- Varargs support in mockable (#3292) (by @senia-psm)
- Varargs support in accessible (#3283) (by @senia-psm)
- implement Gen#bigDecimal (#3295) (by @adamgfraser)
- ZIO Test: Use Suite Execution Strategy in ProvideSomeLayerShared (#3256) (by @adamgfraser)
- implement bigInt (#3282) (by @adamgfraser)
- ZIO Mock support for impure methods, ZStream and ZSink (#3247) (by @ioleo)
- suspend generators (#3245) (by @adamgfraser)
- implement only test aspect (#3248) (by @adamgfraser)
- Rename TestAspect failure -> failing (#3231) (by @ioleo)
- ZIO Mock handle polymorphic methods (#3136) (by...
v1.0.0-RC18-2
A minor release that fixes some issues identified in RC18:
Runtime#unsafeRunToFuturewould auto-interrupt futures quickly due to supervision- There was no way to construct
ZEnvoutsideZLayer; now the default runtimes come equipped withZEnv - The supervision model has been simplified (
SuperviseModeis gone since it was redundant with other features) - Root fibers are now tracked weakly so are less prone to leaking
- Some callback type signatures have been relaxed, to avoid forcing a return of
Uniton the user ZIO.adoptwas added as the inverse ofZIO.disown- More scaladoc has been added
- Parallel ZLayer construction is disabled until an issue with auto-killing is fixed
- More combinators added to
ZLayer, such asfail,orElse,orDie; and theHasconstraint dropped on the output, required only for composition of layers - Mocking component in ZIO Test got a totally new overhaul that removes the need for implicits and allows many more powerful ways of creating expectations (all of, any of, etc.)
v1.0.0-RC18-1
Same as v1.0.0-RC18, fixing the missing documentation for ZLayer.
ZIO 1.0.0-RC18
ZIO 1.0.0-RC18 is the last expected release candidate for ZIO 1.0. There are no breaking changes between RC18 and 1.0, but no guarantees. The current plan is to release 1.0 within a few weeks after RC18, to ensure production-worthiness of 1.0.
Note: All deprecated methods will be deleted for ZIO 1.0.
ZIO Environment
Previously, the official recommended way to use ZIO Environment was to assemble pieces using inheritance to create larger environments out of smaller environments.
In the absence of proxies, this led to some pain around construction of the environment, because creating one class from other classes is not done using value-based operators, but inheritance-specific language features that do not permit abstraction.
Moreover, this approach had several drawbacks:
- Providing just part of an environment was difficult, and was not possible to do generically (the remaining part of the environment had to be known statically).
- It was not possible to dynamically update parts of the environment inside scoped regions, which led to pain when trying to customize services in parts of the application.
Finally, the principal way to make a first service depend on a second service was to list a reference to the second service inside the first (recalling the Cake Pattern self-type). This led to a pattern whereby business logic would express its dependencies by using ZIO Environment, but all other parts of the application would express their dependencies using fields.
These problems have been solved in RC18 with the introduction of two new data types: Has and ZLayer. Together they have led to a new pattern of encoding environmental dependencies, which has been rolled out in ZIO Core services (Clock, Console, Random, System).
While it is still technically possible to use the older pattern, the official ZIO ecosystem (all projects in the ZIO organization on Github) will be migrated to the new pattern.
Has
The new recommended way to assemble environments involves using a new structure called Has. The Has data type has operators for building bigger environments out of smaller environments, including add, which adds a service to a Has, and concat, which merges two Has into one.
ZLayer
ZLayer is a value that represents a recipe for constructing some services in terms of other services. It is similar to a constructor in a Java or Scala application, which takes the services it depends on, and returns the service it constructs (constructor-based dependency injection). Unlike constructors, however, ZLayers are first-class values that compose type-safely in several ways, and they can construct many services, not just one. Additionally, they can describe the effectful and resourceful construction, such as connecting to a database, creating a database thread pool, and when the service is no longer required, freeing the thread pool, and disconnecting from the database.
ZLayer represents the most power you could ever want in describing the construction of a service. In the end, almost all applications need something with this power (as witnessed by the fact that, generally, users of previous ZIO versions resorted to building the environment using ZManaged).
ZLayers can be constructed using a variety of constructors in the companion object of ZLayer. They can be composed horizontally (when one service depends on another), and vertically (for two independent services). Services that are repeated in the graph are automatically shared, to avoid duplicate construction and release. Further, services that can be constructed in parallel are automatically constructed in parallel, to optimize service construction time.
The general pattern of ZIO Environment is now as follows:
type UserRepo = Has[UserRepo.Service]
object UserRepo {
trait Service { def getUserById(id: Id): Task[User] }
def getUserById(id: Id): RIO[UserRepo, User] = ZIO.accessM(_.get.getUserById(id))
}Then typically, a live value is placed in the companion object of the service, which uses ZLayer to construct a production version of the service in terms of its dependencies:
val live: ZLayer[Database, Nothing, UserRepo] = ???Services may be provided to effects that need them using the ZIO#provideLayer method, e.g. myEffect.provideLayer(UserRepo.live).
ZIO Runtime System
Weak automatic supervision
Supervision is now backed by weak sets, which means that child fibers may be freely garbage collected when they cannot resume. This should address memory leaks in scenarios where large numbers of non-terminating fibers are created.
Structured concurrency
All child fibers are automatically bound to their parent fiber. When the parent fiber exits, the child fiber will be interrupted or disowned, as determined by the SuperviseMode it is forked with. The default supervision mode for forked fibers is interruption, which means that by default, when a parent fiber exits, its child fibers will be interrupted. This ensures fibers do not leak.
In order to recapture the previous behavior, one may use forkDaemon, or disown, which explicitly disowns a child fiber and moves it to a root set of fibers.
Safer race
Race no longer forces either side to be interruptible. Users may have to perform left.interruptible.race(right.interruptible) to acquire the old behavior (which punched holes in uninterruptible regions); or possibly, left.disconnect.race(right.disconnect) (if they want the effects to be keep running when interrupted, but in the background).
New combinators
Several new combinators are added:
disconnect — disconnects interruption of the effect from its parent. This allows "early interruption" without waiting for finalization. It replaces the need for all xyzFork variants, which are now deprecated. It's quite useful with race, with or without interruptible.
disown — Called by a parent fiber to disown a child fiber. Relocates the child to the root set.
New ZIO.never
When ZIO.never is forked, it will be garbage collected, so ZIO.never.onInterrupt(putStrLn("Bye")) will never execute the finalizer. This can be inconvenient for testing, so ZIO.infinity is added which is like never, but won't be garbage collected.
Deletion of Daemon Mode
Daemon mode has been deleted because in practice, code never knows whether grandchildren should be daemons, only whether immediate children should be daemons; and generally, daemon mode is a one-off for a specific forked fiber.
In place of daemon mode, effect.forkDaemon can be used, which is the composition of two other operators: ordinary fork, followed by an immediate disown of the child fiber.
Deprecation of *Fork Variations
All xyzFork variants are deprecated or removed. For example, bracketFork. This is thanks to the new disconnect operator which allows for a much more compositional approach to solving this problem. Now if you don't want interruption of something to wait around for completion, just use effect.disconnect.
Performance enhancements for blocking effects
Blocking effects has seen several enhancement regarding performance, with potential change in semantic:
- Now, calling
lockon a fiber first checks to see if the fiber is already on the correct Executor and does nothing if in that case; effectBlockingdoesn’t interrupt the underlying thread anymore in case of fiber interruption. If you want to revert to previous behavior, useeffectBlockingInterrupt.Blockingexecutor ergonomics were updated to enhance thread reuse and limit risk to crash the server in case of massive thread leak.
ZIO General API
Laziness
Effect constructors are now lazy. This is done to ensure that if users embed side-effects in unexpected places, then errors are managed by ZIO.
Deprecated traverse/sequence
Rather than have duplicate names for operators, the decision was made to deprecate the "classic names" for traverse/sequence, in favor of friendlier and more descriptive names foreach/collectAll.
ZIO Test
Inheritance Based Specs
Spes are now defined by inheriting from DefaultRunnableSpec instead of using constructor arguments:
object ExampleSpec extends DefaultRunnableSpec {
def spec = suite(“ExampleSpec)(
test(“addition works”) {
assert(1 + 1)(equalTo(2))
}
)
}This provides a more natural syntax for writing tests and allows defining data or helper methods in the same object instead of requiring a separate utility object.
Type Safe Equality
To provide increased type safety, the syntax for assertions has changed from assert(1 + 1, equalTo(2)) to assert(1 + 1)(equalTo(2)). This curried syntax allows the test framework to issue a compilation error if an equality assertion is comparing two unrelated types, catching bugs earlier. A ScalaFix migration rule is provided to automatically rewrite assertions to the new curried syntax.
Improved Test Console Behavior
To facilitate debugging, by default the TestConsole will now render output to the standard output in addition to writing it to the output buffer. This feature is configurable on a scoped basis using the debug and silent methods on TestConsole or the corresponding test aspects.
Test Annotations
Test annotations provide flexible information for reporting metadata about tests. ZIO Test ships with a variety of test annotations that will automatically track metrics such as the number of ignored tests, the number of times a test was retried using flaky and the number of times a test was repeated using nonFlaky. Users can apply additional annotations using test aspects, for example timing the execution of tests and showing the slowest tests using timed or labeling tests with tag.
In the future test annotations ...
1.0.0-RC17
Notable changes
This release contains major changes related to how fiber supervision is working.
The new behavior is that a fiber will automatically be interrupted when its parent fiber is interrupted. To make forked fibers independent of their parents, use .daemon.
Previously existing interruptChildren, supervised, unsupervised, checkSupervised, superviseStatus have been removed in favor of daemon, nonDaemon, checkDaemon and daemonStatus.
ZIO
- Complete overhaul of supervision (#2169) by @jdegoes
- Add fiber dumps with pretty printing for easier diagnostics (#2228) by @jdegoes
- Add a new implicit instance
CanFail[E]which provides implicit evidence that an effect with an error type E can fail, that is that E is not equal to Nothing. Requires such evidence to exist for ZIO combinators such as orElse that only make sense if an effect can fail (#2049) by @adamgfraser - Similarly, implements
NeedsEnvso that useless combinators involving effects that don't require an environment don't compile (#2065) by @adamgfraser - Add
ZIO.fromFunctionFuture(#1961) by @jczuchnowski effectAsyncshould not resume fiber twice after interruption (#1939) by @darl- Add
withFilter(#2114) by @wi101 - Use
URIOin type signatures where possible (#2092) by @joroKr21 - Add
ZIO#doUntilandZIO#doWhile(#2147) by @adamgfraser Ignoreshould not recover from unchecked exceptions (#2148) by @alexvanolst- Reimplement
RaceWithin the ZIO runloop for better performance (#2091) by @YuvalItzchakov - Adapt
ZIO.someOrFailExceptionto improve interop with error types (#2087) by @mlangc - Fix
CauseDefinition of Equals and HashCode (#2220) by @adamgfraser - Improve implementation of
InterruptStatus#isInterruptible(#2188) by @sirthias
ZIO Stream
- Add
ZStreamChunk#mapError(#2064) by @vasilmkd - Add missing
extends Serializableto ZStream codebase (#2063) by @vasilmkd - Make
ZStream.empty,ZStream.fail,ZStream.effectAsyncand others safe to pull again (#2051 #2139 #2189 #2197 #2198 #2199 #2227) by @vasilmkd - Add
ZSink.fromFunctionM(#2112) by @regiskuckaertz - Add
ZStream#collectM,collectWhileM(#2094) by @saraiva132 - Make
ZStream#chunkNreturn an instance ofZStreamChunk(#2125) by @saraiva132 - Rename
transduce,aggregateandaggregateWithintoaggregate,aggregateAsyncandaggregateAsyncWithin(#2099) by @simpadjo - Add new shorthands for running ZStream:
runHeadandrunLast(#2113) by @alexvanolst - Add
accessandaccessMto ZStream (#2249) by @pk044 - Add more
ZStream#distributedbased combinators (#2157) by @mschuwalow
ZIO Test
- Add a new assertion
compilethat requires the specified string to be valid Scala code (#2215) by @adamgfraser - Make Companion Objects of Test Environments Serializable (#2067) by @adamgfraser
- Implement
TestClock#setDateTime(#2072) by @adamgfraser - Implement
Gen#long(#2132) by @adamgfraser - Implement Overloaded Version of
TestAspect#nonFlaky(#2140) by @adamgfraser - Implement
ExceptVariants of Test Aspects (#2146) by @adamgfraser - Adding
hasFirst,hasLastandhasAtassertions (#2156) by @13h3r - Refactor
ZSpecto Move All Test Failures to Error Channel (#2145) by @adamgfraser - Limit number of runs when using
flaky(#2170) by @adamgfraser - Implement
TestAspect#nonFlakyPar(#2176) by @adamgfraser - Fix Type Inference Issue in
checkMVariants (#2175) by @adamgfraser - Fix Naming Conflict with
TestAspect#ignore(#2184) by @adamgfraser - Suspend Effects in
testM(#2190) by @adamgfraser - Implement Warnings for Test Clock (#2191) by @adamgfraser
- Move Check Variants Back Into Package Object (#2181) by @adamgfraser
- Improvements to
provideManagedShared(#2192) by @adamgfraser - Support Labeled Assertions (#2200) by @adamgfraser
- Prevent Spurious TestClock Warnings (#2210) by @adamgfraser
- Remove Creation of New Runtimes (#2213) by @adamgfraser
- New Test Aspect
onlythat when applied on a suite will ignore all tests that don't have the given substring in their label (#1838) by @dkarlinsky - Fix Bug in
Gen#alphaNumericChar(#2233) by @adamgfraser - Improve Order of Parameters in
checkSome(#2224) by @adamgfraser - Fix Type Inference Issue With
TestAspect#retry(#2218) by @adamgfraser - Add generators for time datatypes (#2173) by @dieproht
STM
- Add
TMap.merge(#2097) by @regiskuckaertz - Remove notion of immutability from TArray (#2111) by @Stefanqn
- Make
TArrayfactories return STM (#2141) by @smart-ass - Support keys with negative hashCodes in
TMap(#2203) by @laurynasl-wix
Schedule
- Rename
ZScheduletoSchedule(#2242) by @adamgfraser - Rename
logInput/logOutputtotapInput/tapOutput(#2050) by @mschuwalow - Improve
onDecisionsignature (#2089) by @YuvalItzchakov
ZManaged
- Make parts of
ZManagedprivate (#2124) by @stkeky - Add
asError,catchAllCause,catchSomeCause,collect,collectM` (#2135 #2137 #2149) by @dkarlinsky - Add
sandboxWith,eventually(#2151 #2161) by @saraiva132 - Add
allocated(#2158) by @mschuwalow - Add
absorbandabsorbWith(#2116) by @alexvanolst - Add
ZManaged.memoize(#2016) by @mlangc
Chunk
- In
Chunk#flatMap, construct result array from the back (#2165) by @vasilmkd - Add
collectM,collectWhileMcombinators (#2150) by @saraiva132 - Fix
Chunk.sizethat was always returning 0 (#2217) by @ajaychandran
Semaphore
- Deprecate
acquire,acquireN,release,releaseNin favor ofwithPermits(#1523) by @adamgfraser
Duration
- Use
toMillisfor java infinity duration (#2209) by @TapanVaishnav
1.0.0-RC16
Notable changes
ZIO
- Refactor Schedule's encoding to accurately reflect required environment (#1798) by @mschuwalow
- Add ZManaged.makeInterruptible (#2046) by @neko-kai
- Make Fiber Composition Parallel (#2038) by @adamgfraser
- Add TSet (#2029) by @mijicd
- Add TMap (#2017) by @mijicd
- Make Cause#foldLeft Stack Safe (#1990) by @adamgfraser
- Add ZManaged aliases (#1999) by @ioleo
ZIO Stream
- Add Chunk#mapAccumM and ZStreamChunk#mapAccumM (#2041) by @vasilmkd
- Implement ZSink#tapInput and ZSink#tapOutput (#2044) by @adamgfraser
- Add
ZSink.splitOn(#2006) by @regiskuckaertz - Add error handling combinators to ZStreamChunk (#2002) by @vasilmkd
- Properly name ZStream#mapConcat* combinators (#2012) by @vasilmkd
- Add ZStreamChunk#provide combinators (#2015) by @vasilmkd
- Add ZStreamChunk#ensuring and ZStreamChunk#ensuringFirst (#2010) by @vasilmkd
- Add Chunk#filterM and ZStreamChunk#filterM (#2011) by @vasilmkd
- Correct the type signature for
zio.stream.ZSink#optional(#1988) by @gerdreiss - Add dropUntil and takeUntil to ZStreamChunk (#1982) by @vasilmkd
ZIO Test
In this release, the mocking framework API has gone through complete overhaul to be more concise and feature better type inference. Notable changes:
- The capability tags for default mock services are moved directly to modules companion object. Use
MockClock.nanoTimeinstead ofMockClock.Service.nanoTime; - The expectations are now methods on capability tags. Use
MockRandom.nextInt._0(equalTo(1)) returns value(42)instead ofMockSpec.expect_(MockRandom.Service.nextInt._0)(equalTo(1))(42); - Assertions for input are now passed as arguments, e.g.
MockConsole.putStrLn(equalTo("foo")) returns unit; - Stubbing returns is done via static methods
value,valueF,valueM,failure,failureF,failureM,unit, andneverinzio.test.mock.Expectation; - Dummy services (expecting no calls) are constructed using a static method
nothingfromzio.test.mock.Expectation. For example,val dummyConsole = Expectation.nothing[MockConsole]; - The conversion to managed mock service is automatic and does not require any imports or type hints.
For more examples, see MockingExampleSpec.
Additional changes:
- Make flaky retry tests that die (#2045) by @adamgfraser
- Implement decorators for test environment (#2043) by @adamgfraser
- Add Expectation.nothing (#2042) by @ioleo
- Add assertCompletes (#2035) by @adamgfraser
- Refactor FailureDetails to report the entire error hierarchy (#1985) by @adamgfraser
- Implement TestAspect#ifEnv (#1962) by @adamgfraser
- Add suite selection and support multiple terms (#2014) by @reibitto
- Overhaul the mocking framework (#2000) by @ioleo
1.0.0-RC15
Notable changes
Build
ZIO, ZIO Test and ZIO Streams are now published for Dotty. This release builds against Dotty 0.19.
ZIO
- Make
ZIO#asErrorargument by-name to matchZIO#asby @neko-kai (#1905) - Rename
Chunk#notEmptytononEmpty, addChunk#sizeby @iravid (#1913) - Add
ZEnv- a convenient definition for the standard ZIO environment by @mschuwalow (#1915) - Add mapping functions for
ZEnv's components by @mschuwalow (#1957) - Add
Promise#completeWithand memoize the IO passed toPromise#complete(semantics have changed here - take note if usingPromise#complete) by @adamgfraser (#1954) - Reduce spurious FiberFailure warnings in built-in combinators by @adamgfraser (#1949)
ZIO Test
- Display a summary of failed and ignored tests by @kapke (#1786)
- Improve the inference for
Assertion#equalToby @adamgfraser (#1946)
ZIO Streams
v1.0.0-RC14
Notable changes
ZIO
- Add tests of serialization for all ZIO data types and make
Promiseserializable (#1771) by @jakubjanecek - Implement raceAll without folding with
race(#1424) by @chikei - Parameterized environment on
zio.Canceler(#1763) by @ajaychandran - Expose
ExecutorasExecutorService(#1745) by @jczuchnowski - Suspend
ZIO.as&ZStream.asagain (#1822) by @neko-kai - Fix #785, Fix #1441, prevent race condition on
interruptedvariable by movinginterruptedinto atomic state (#1792) by @neko-kai - Add
CancelableFuture(#1655) by @fsvehla - Prevent
ZIO.optionfrom catching unchecked errors (#1870) by @darl - Implement
ZIO#timeoutFork(#1856) by @adamgfraser - Add Meta Subtype to Cause (#1706) by @adamgfraser
- Make everything private that can / should be private (#1751) by @zezutom
- Allow custom behavior on inheritFiberRefs (#1879) by @mschuwalow
- Make sure that
FiberRefs are inherited inZIO.raceAll(#1902) by @mlangc
ZIO Test
In this release the internal representation of Spec has been changed to make all Specs effectual. This allows for performing effects on groups of tests in additional to individual tests. We expect this will not require any changes from most users but may be breaking for code that relies on some methods on Spec or the particular encoding of ZSpec. Please report any issues you notice!
- [Breaking] Moved package
zio.test.mocktozio.test.environment(#1830) by @ioleo - [Breaking] Renamed
MockConsole,MockClock,MockSystemandMockRandomtoTest*equivalents (within the moved package) (#1830) by @ioleo - Added mocking framework under
zio.test.mockpackage (#1830) by @ioleo - Support shared managed resources (#1664) by @adamgfraser
- Added rendering of
zio.test.mock.MockExceptiondefects inzio.test.DefaultTestReporter(#1830) by @ioleo - Make
failureaTestAspect(#1741) by @jaliss - Add interrupt deadline to
timeoutTestAspect (#1824) by @LGLO - Simplify
TestAspect#around(#1718) by @adamgfraser - Harden
MockClock(#1885) by @adamgfraser - Add fibertime to public api of
MockClock(#1890) by @mschuwalow - Implement multiple parameter function generators (#1893) by @adamgfraser
- Add
Gen.anyUnicodeChar(#1901) by @regiskuckaertz
ZIO Stream
- Port ZStream.fromInputStream to StreamEffect (#1772) by @jsilva
- Fix
Chunk.empty.toArraythrowsClassCastException(#1797) by @wi101 - Add a method for converting
ZStream[Byte]to aZManaged[java.io.InputStream](#1784) by @sideeffffect - Add
ZManaged.switchable(#1810) by @iravid - Implement pure
ZSink.ignoreWhile(#1820) by @vasilmkd - Clear up some
Chunkhotspots(#1825) by @iravid - Back presssure in
ZStream.effectAsync*(#1855) by @darl - Reduce allocations in
ZStream#unTake(#1861) by @vasilmkd - Add
ZStream#toQueueUnbounded(#1860) by @vasilmkd - Add
ChunkNtoZStream(#1795) by @LukaszByczynski - Optimize
ChunkN(#1881) by @mvv - Add ZStream combinators for dropping/sliding buffers (#1685) by @vasilmkd
- Align StreamChunk and Chunk's foldings methods with ZStream (#1778) by @kamilkloch