v0.14.0
What's Changed
state
->store
by @armanbilge in #124- Update cats-effect, cats-effect-kernel, ... to 3.4.10 by @scala-steward in #123
- Experimental/store redesign by @buntec in #125
IMPORTANT: This release introduces a breaking change to the store API. We've replaced Ref[F, State] => Action => F[Unit]
with Action => State => (State, Option[F[Option[Action]]])
. This will break all existing user code but the required changes should be fairly mechanical and confined to the construction of the store. Actions that are pure state updates now take the form state => state.copy(foo = 17) -> none
. Any effect associated with an action (e.g., a REST call) goes into the F[Option[Action]]
bit. If this effect completes with Some(Foo)
, then the Foo
action will subsequently be submitted to the store. (See example6
on how to achieve cancellation of long-running effects using a Supervisor
. )
The motivation for this change is to enforce atomic, strictly ordered state updates. Before, if you
weren't careful, you could end up with a race condition if an action handler contained multiple calls to state.get
, state.set
, state.update
etc., because all actions were running concurrently and a Ref[F, State]
was exposed. In the new model, state updates are clearly atomic, while (long-running) effects are still executed concurrently (and may trigger follow-up actions).
Huge thanks to @armanbilge for fruitful discussions!
Full Changelog: v0.13.0...v0.14.0