Skip to content

Commit 8e38eda

Browse files
authored
Merge pull request #3858 from typelevel/release/3.5.2-major
Merge changes from 3.5.2 into series/3.x
2 parents 3868b98 + 22cc77b commit 8e38eda

File tree

15 files changed

+120
-29
lines changed

15 files changed

+120
-29
lines changed

.github/release.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@ changelog:
22
categories:
33
- title: Features
44
labels:
5-
- :mushroom: enhancement
5+
- ':mushroom: enhancement'
66
- title: Bug Fixes
77
labels:
8-
- :beetle: bug
8+
- ':beetle: bug'
99
- title: Behind the Scenes
1010
labels:
11-
- :gear: infrastructure
12-
- :robot:
11+
- ':gear: infrastructure'
12+
- ':robot:'
1313
- title: Documentation
1414
labels:
15-
- :books: docs
15+
- ':books: docs'
16+
# Not for published notes, just to make sure we don't forget any accidentally unlabeled PRs
17+
- title: Uncategorized
18+
labels:
19+
- '*'

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
## Getting Started
1313

14-
- Wired: **3.5.1**
14+
- Wired: **3.5.2**
1515
- Tired: **2.5.5** (end of life)
1616

1717
```scala
18-
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.1"
18+
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.2"
1919
```
2020

2121
The above represents the core, stable dependency which brings in the entirety of Cats Effect. This is *most likely* what you want. All current Cats Effect releases are published for Scala 2.12, 2.13, 3.0, and Scala.js 1.7.
@@ -30,22 +30,22 @@ Depending on your use-case, you may want to consider one of the several other mo
3030

3131
```scala
3232
libraryDependencies ++= Seq(
33-
"org.typelevel" %% "cats-effect-kernel" % "3.5.1",
34-
"org.typelevel" %% "cats-effect-laws" % "3.5.1" % Test)
33+
"org.typelevel" %% "cats-effect-kernel" % "3.5.2",
34+
"org.typelevel" %% "cats-effect-laws" % "3.5.2" % Test)
3535
```
3636

3737
If you're a middleware framework (like [Fs2](https://fs2.io/)), you probably want to depend on **std**, which gives you access to `Queue`, `Semaphore`, and much more without introducing a hard-dependency on `IO` outside of your tests:
3838

3939
```scala
4040
libraryDependencies ++= Seq(
41-
"org.typelevel" %% "cats-effect-std" % "3.5.1",
42-
"org.typelevel" %% "cats-effect" % "3.5.1" % Test)
41+
"org.typelevel" %% "cats-effect-std" % "3.5.2",
42+
"org.typelevel" %% "cats-effect" % "3.5.2" % Test)
4343
```
4444

4545
You may also find some utility in the **testkit** and **kernel-testkit** projects, which contain `TestContext`, generators for `IO`, and a few other things:
4646

4747
```scala
48-
libraryDependencies += "org.typelevel" %% "cats-effect-testkit" % "3.5.1" % Test
48+
libraryDependencies += "org.typelevel" %% "cats-effect-testkit" % "3.5.2" % Test
4949
```
5050

5151
Cats Effect provides backward binary compatibility within the 2.x and 3.x version lines, and both forward and backward compatibility within any major/minor line. This is analogous to the versioning scheme used by Cats itself, as well as other major projects such as Scala.js. Thus, any project depending upon Cats Effect 2.2.1 can be used with libraries compiled against Cats Effect 2.0.0 or 2.2.3, but *not* with libraries compiled against 2.3.0 or higher.

docs/core/native-image.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ThisBuild / scalaVersion := "2.13.8"
3333

3434
lazy val root = (project in file(".")).enablePlugins(NativeImagePlugin).settings(
3535
name := "cats-effect-3-hello-world",
36-
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.1",
36+
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.2",
3737
Compile / mainClass := Some("com.example.Main"),
3838
nativeImageOptions += "--no-fallback",
3939
nativeImageVersion := "22.1.0" // It should be at least version 21.0.0

docs/core/scala-native.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ lazy val root = project.in(file("."))
2222
.enablePlugins(ScalaNativePlugin)
2323
.settings(
2424
name := "cats-effect-3-hello-world",
25-
libraryDependencies += "org.typelevel" %%% "cats-effect" % "3.5.1",
25+
libraryDependencies += "org.typelevel" %%% "cats-effect" % "3.5.2",
2626
Compile / mainClass := Some("com.example.Main")
2727
)
2828

docs/core/test-runtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ For those migrating code from Cats Effect 2, `TestControl` is a considerably mor
2828
In order to use `TestControl`, you will need to bring in the **cats-effect-testkit** dependency:
2929

3030
```scala
31-
libraryDependencies += "org.typelevel" %% "cats-effect-testkit" % "3.5.1" % Test
31+
libraryDependencies += "org.typelevel" %% "cats-effect-testkit" % "3.5.2" % Test
3232
```
3333

3434
## Example

docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ title: FAQ
99

1010
```scala-cli
1111
//> using scala "2.13.8"
12-
//> using lib "org.typelevel::cats-effect::3.4.11"
12+
//> using lib "org.typelevel::cats-effect::3.5.2"
1313
1414
import cats.effect._
1515

docs/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Getting Started
66
Add the following to your **build.sbt**:
77

88
```scala
9-
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.1"
9+
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.2"
1010
```
1111

1212
Naturally, if you're using ScalaJS, you should replace the double `%%` with a triple `%%%`. If you're on Scala 2, it is *highly* recommended that you enable the [better-monadic-for](https://github.com/oleg-py/better-monadic-for) plugin, which fixes a number of surprising elements of the `for`-comprehension syntax in the Scala language:
@@ -62,7 +62,7 @@ We will learn more about constructs like `start` and `*>` in later pages, but fo
6262
Of course, the easiest way to play with Cats Effect is to try it out in a Scala REPL. We recommend using [Ammonite](https://ammonite.io/#Ammonite-REPL) for this kind of thing. To get started, run the following lines (if not using Ammonite, skip the first line and make sure that Cats Effect and its dependencies are correctly configured on the classpath):
6363

6464
```scala
65-
import $ivy.`org.typelevel::cats-effect:3.4.11`
65+
import $ivy.`org.typelevel::cats-effect:3.5.2`
6666

6767
import cats.effect.unsafe.implicits._
6868
import cats.effect.IO

docs/migration-guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ Cats Effect 3 splits the code dependency into multiple modules. If you were prev
8181
The current non-test modules are:
8282

8383
```scala
84-
"org.typelevel" %% "cats-effect-kernel" % "3.5.1",
85-
"org.typelevel" %% "cats-effect-std" % "3.5.1",
86-
"org.typelevel" %% "cats-effect" % "3.5.1",
84+
"org.typelevel" %% "cats-effect-kernel" % "3.5.2",
85+
"org.typelevel" %% "cats-effect-std" % "3.5.2",
86+
"org.typelevel" %% "cats-effect" % "3.5.2",
8787
```
8888

8989
- `kernel` - type class definitions, simple concurrency primitives
@@ -96,7 +96,7 @@ The current non-test modules are:
9696
libraryDependencies ++= Seq(
9797
//...
9898
- "org.typelevel" %% "cats-effect" % "2.4.0",
99-
+ "org.typelevel" %% "cats-effect" % "3.5.1",
99+
+ "org.typelevel" %% "cats-effect" % "3.5.2",
100100
//...
101101
)
102102
```

docs/std/mapref.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
id: mapref
3+
title: MapRef
4+
---
5+
6+
A total map from a key to a `Ref` of its value.
7+
8+
```scala mdoc:silent
9+
import cats.effect.Ref
10+
11+
trait MapRef[F[_], K, V] {
12+
13+
/**
14+
* Access the reference for this Key
15+
*/
16+
def apply(k: K): Ref[F, V]
17+
}
18+
```
19+
20+
It is conceptually similar to a `Ref[F, Map[K, V]]`,
21+
but with better ergonomics when working on a per key basis.
22+
Note, however, that it does not support atomic updates to multiple keys.
23+
24+
Additionally, some implementations also provide less contention:
25+
since all operations are performed on individual key-value pairs,
26+
the pairs can be sharded by key.
27+
Thus, multiple concurrent updates may be executed independently to each other,
28+
as long as their keys belong to different shards.
29+
30+
### In-Memory database
31+
32+
This is probably one of the most common uses of this datatype.
33+
34+
```scala mdoc:reset:silent
35+
//> using lib "org.typelevel::cats-effect::3.5.2"
36+
37+
import cats.effect.IO
38+
import cats.effect.std.MapRef
39+
40+
trait DatabaseClient[F[_], Id, Data] {
41+
def getDataById(id: Id): F[Option[Data]]
42+
def upsertData(id: Id, data: Data): F[Unit]
43+
}
44+
45+
object DatabaseClient {
46+
def inMemory[Id, Data]: IO[DatabaseClient[IO, Id, Data]] =
47+
MapRef.ofShardedImmutableMap[IO, Id, Data](
48+
shardCount = 5 // Arbitrary number of shards just for demonstration.
49+
).map { mapRef =>
50+
new DatabaseClient[IO, Id, Data] {
51+
override def getDataById(id: Id): IO[Option[Data]] =
52+
mapRef(id).get
53+
54+
override def upsertData(id: Id, data: Data): IO[Unit] =
55+
mapRef(id).update(_ => Some(data))
56+
}
57+
}
58+
}
59+
```

docs/std/ref.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This is probably one of the most common uses of this concurrency primitive.
3333
In this example, the workers will concurrently run and update the value of the `Ref`.
3434

3535
```scala mdoc:reset:silent
36-
//> using lib "org.typelevel::cats-effect:3.4.11"
36+
//> using lib "org.typelevel::cats-effect::3.5.2"
3737

3838
import cats.effect.{IO, IOApp, Sync}
3939
import cats.effect.kernel.Ref

0 commit comments

Comments
 (0)