Releases: typelevel/cats-effect
v1.0.0-RC2
This is the second and final release candidate before 1.0 — it's not a planned release candidate, but due to a flurry of activity and awesome PRs from FS2, Monix and Http4s contributors, we can't release a 1.0 with so much being added, a total of 35 PRs, which aren't light at all, a record for this project.
List of Changes
New data types:
Resource
(doc) — #188Ref
(doc) andDeferred
(doc) — #204, #211, #218 and #220Semaphore
(doc) — #205MVar
(doc) — #217, #222, #223, #224IOApp
(doc) — #213, #252
Major behavioral / breaking changes:
- #232: Require
Timer
andshift
automatically in concurrent operations - #237, #254: Restate
Concurrent
laws to accept auto-cancelable run-loops - #241: Move
uncancelable
toBracket
, changeBracket
laws to makeacquire
andrelease
uncancelable - #195, #215 and #261: Add
Effect#runSyncStep
, fixing #104 - #248, #258: Introduce
Async.asyncF
- #221: add
toIO
operation toEffect
Added Features:
- #191: Add
IO#redeemWith
, in combination with the future typelevel/cats/pull/2237 - #214: Add
IO#timeout
andConcurrent.timeout
- #236:
Bracket
instance for Kleisli - #234:
bracket
should work on top of JavaScript viaunsafeRunSync
- #235: remove
NonFatal
, switch to the standard one - #250: Optimize async trampoline, add
ContextSwitch
- #255, #257: use the standard
Throwable#addSuppressed
inbracket
when bothuse
andrelease
throw - #253: Add a la carte syntax package, syntax for Bracket and timeouts
Docs:
- #201: Docs for
parTraverse
andparSequence
- #203: Docs for
Resource
,Deferred
,Ref
andSemaphore
- #238: Docs for
Resource
Bug fixes and chores:
- #225:
IOTimer
does not use the parameter specified - #260: Exclude non-terminating laws from default set
- #259: Decrease default
stackSafeIterationsCount
in laws
Getting Involved
You can always help with:
- Feedback by joining us on Gitter
- Re-tweet the release announcement
- Give us a star on GitHub 🙂
Special Thanks
This release was made possible by: @rossabaker, @mpilquist, @SystemFw, @oleg-py, @johnynek, @durban, @ptravers, @stephennancekivell, @gvolpe, @ajaychandran and @alexandru .
(apologies if I forgot anybody)
Thanks to all those involved!
v1.0.0-RC
This is the first and hopefully only release candidate for 1.0.0.
This upgrade breaks binary compatibility with the previous 0.10
, so use with care — libraries that depend on Cats Effect must be upgraded first. This version also drops Scala 2.10 support.
The highlight of this release is the Bracket
type class, along with its IO
implementation, IO#bracket
and IO#bracketCase
.
Details of usage with IO
have been added in the documentation, see the new section:
Safe Resource Acquisition and Release
Features:
- #113, #186: Adds
Bracket
type class, along withIO
changes, for exposingbracket
andbracketCase
, operations meant for safe release of resources - #182:
IO.runAsync
should report errors in its handler (back-ported in0.10.1
) - #168: adds
Async#never
- #183: adds new config parameter meant for
AsyncTests
to disable laws that are testing for non-termination
Breaking changes:
Chores:
Cancelable IO (v0.10)
v0.10 represents a big milestone for the upcoming 1.0.0
(see milestones), bringing you the new and improved IO
data type, along with new type classes in support of cancelation.
But first, we now have a documentation website:
typelevel.org/cats-effect/
Checkout the document for IO
:
typelevel.org/cats-effect/datatypes/io.html
And also the published ScalaDocs:
typelevel.org/cats-effect/api/
Note: this release is binary compatible with 0.9, but not source compatible, as it has some small API cleanups, deprecated via private[package]
— see below for details 😉
Features for cancelation:
- #121: the cancelable
IO
- #132 and #133: added the
Timer
data type, to be able to do delayed execution and time measurements in a pure way, while also curing IO's heavy dependency onExecutionContext
- #134: adds the new
Concurrent
andConcurrentEffect
type classes, to complement the existing type classes with cancelation capabilities - #137, #142 and #145: adds
race
andracePair
inIO
and in theConcurrent
type class, for describing race conditions - #135, #143, #147, #149, #151, #153, #155, #156, #157: starts a documentation Microsite for Cats-effect, w00t!
Improvements for the provided instances:
- #144: re-adds
cats.data.Kleisli
instances, useful for example for Frameless, coupled with #2185 incats-core
in order to preserve coherence - #146: optimizes our internal
AndThen
implementation, currently used for makingIndexedStateT
stack safe for left-associated binds — this will soon be gone from cats-effect though, due to PR #2187 being merged incats-core
Other:
- #130: changed copyright headers in source files to mention a year range, plus it makes it clear that copyright is held by contributors
API breakage
This version is binary compatible with version 0.9, so you can upgrade cats-effect
without worries for your other dependencies. However it contains some minor API cleanups that might make your compiler to emit errors.
Async#shift
is now deprecated:
trait Async[F[_]] extends Sync[F] with LiftIO[F] {
// ...
@deprecated("Moved to Async$.shift, will be removed in 1.0", "0.10")
private[effect] def shift(ec: ExecutionContext): F[Unit] =
Async.shift(ec)(this)
Async#shift
was moved to the Async
companion object. So code like this:
def execute[F[_]](thunk: => A)(implicit F: Async[F], ec: ExecutionContext): F[A] =
F.shift *> F.delay(thunk)
Needs to be changed to ...
def execute[F[_]](thunk: => A)(implicit F: Async[F], ec: ExecutionContext): F[A] =
Async.shift[F](ec) *> F.delay(thunk)
The reason for the hard deprecation is that there's no potential for optimization and so it doesn't belong on the Async
type class, the derived implementation being the best you can do, in terms of the provided ExecutionContext
. It also forces apps to prepare for the upcoming 1.0.0
sooner.
IO.fromFuture
no longer requires an ExecutionContext
In case you used IO.fromFuture
, it was using an ExecutionContext
, but now with 0.10
it will stop doing that ...
import scala.concurrent.ExecutionContext.Implicits.global
IO.fromFuture(IO(Future(1 + 1)))
What happens with the upgrade to 0.10 is that the provided context in this sample will stop being used. So the compiler or the IDE might end up emitting an "unused import" warning.
But if you provided the ExecutionContext
explicitly, then this is going to be a compilation error:
// This triggers an error in 0.10
IO.fromFuture(IO(Future(1 + 1)))(global)
Note that the old symbols in both cases are still there, but made private[package]
— so binary compatibility is preserved.
v0.10.1
v0.9
This is the last release before PR #121 gets merged.
The highlight of the release is the provided cats.Parallel type-class instance for IO
. This makes it now possible to process IO
values in parallel, out of the box:
Simple sample:
import cats.implicits._
val name: IO[String] = getName(id)
val age: IO[Int] = getAge(id)
// Assuming `name` and `age` are asynchronous IOs, they'll
// get processed in parallel ...
(name, age).parMapN { (name, age) => Person(name, age) }
Changes:
- PR #115 (issue #83):
cats.Parallel[IO, IO.Par]
implementation - PR #110 (issue #94): add
SemigroupK
instance forIO
- PR #111 (issue #108): re-throw exception in IO.async after callback was called once
- PR #114: switch traits to abstract classes for better bincompat
- PR #119 (issue #118): change check in SyncLaws to allow streaming types
- PR #125: fixes omission in
AsyncTests
v0.8
v0.5
v0.4
We expect this to be the last major release before cats-effect 1.0, which will target cats-core 1.0 when it is released. There really aren't any major changes left to be made, and stability is a major goal going forward.
Changes in this release:
Effect#liftIO
has been removed, since it was redundant- The stack safety and error propagation laws that were formerly in
EffectLaws
have been moved up toSyncLaws
. This strengthens the requirements on effects which implementSync
but not `Effect - Removed
Kleisli
inductive instances (because of typelevel/cats#1733) - Added a law governing the error propagation behavior of
Effect#runAsync
- Bumped cats-core dependency to 1.0.0-MF
v0.3
- Improved and simplified version of
shift
(#58) - Added an instance
Sync[EitherT[Eval, Throwable, ?]]
. This is designed to replace the now-removedMonadError
functionality incats.Eval
with a sound equivalent.
We are expecting that this will be one of the last compatibility-breaking releases prior to 1.0. The only further changes we would anticipate would be to the laws, but we certainly cannot rule out more.