Skip to content

Commit 2976784

Browse files
serrasnomisRev
andauthored
Release 2.2.0 (#430)
Co-authored-by: Simon Vergauwen <nomisRev@users.noreply.github.com>
1 parent 9da6047 commit 2976784

55 files changed

Lines changed: 1000 additions & 338 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ yarn-error.log*
3030

3131
.idea
3232

33+
.kotlin
34+
3335
### Gradle ###
3436
.gradle
3537
**/build/

build.gradle.kts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import kotlinx.knit.KnitPluginExtension
22

33
buildscript {
4-
repositories {
5-
mavenCentral()
6-
}
4+
dependencies { classpath(libs.kotlinx.knit) }
5+
}
76

8-
dependencies {
9-
classpath(libs.kotlinx.knit)
10-
}
7+
repositories {
8+
mavenCentral()
119
}
1210

13-
@Suppress("DSL_SCOPE_VIOLATION")
1411
plugins {
1512
alias(libs.plugins.kotlin.jvm)
1613
}

content/blog/2023-04-04-arrow-1-2-0-rc-summary.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Arrow 1.2.0-RC Release Summary
3-
image: https://xebia.com/wp-content/uploads/2023/04/arrow-1-2-0-rc-twitter.jpg
3+
image: /img/arrow-release-ftr.jpg
44
category: articles
55
tags: [core, articles]
66
link: https://xebia.com/blog/arrow-1-2-0-rc-is-now-available/
@@ -14,4 +14,4 @@ We're excited to announce Arrow 1.2.0-RC alongside a new Arrow website. To brief
1414
- Adds more options for [resilience](http://arrow-kt.io/learn/resilience/).
1515
- Marks every function and type we intend to remove in 2.0 as `@Deprecated`.
1616

17-
Read more details in the full [Arrow 1.2.0 release announcement](https://xebia.com/blog/arrow-1-2-0-rc-is-now-available/).
17+
Read more details in the full [Arrow 1.2.0 release announcement](https://xebia.com/blog/arrow-1-2-0-rc-is-now-available/).

content/blog/2023-07-12-arrow-1-2-0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Arrow releases stable 1.2.0 version
3-
image: https://xebia.com/wp-content/uploads/2023/04/arrow-release-ftr.jpg
3+
image: /img/arrow-release-ftr.jpg
44
category: articles
55
tags: [core, articles]
66
link: https://xebia.com/blog/a-new-module-for-typed-errors-in-arrow-1-2-0/

content/blog/2024-12-05-arrow-2-0.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Arrow 2.0 release
3-
image: https://xebia.com/wp-content/uploads/2023/04/arrow-release-ftr.jpg
3+
image: /img/arrow-release-ftr.jpg
44
category: articles
55
no_image_on_post: true
66
tags: [core, articles]
@@ -93,7 +93,7 @@ parZip(
9393
) { file, data -> Result(file, data) }
9494
```
9595

96-
The new [`awaitAll` scope](/learn/coroutines/parallel/#await-all-scopes) tries to improve the situation by tweaking the
96+
The new [`awaitAll` scope](/learn/coroutines/parallel/#await-all--parallelism-experimental) tries to improve the situation by tweaking the
9797
usual `async` mechanism, ensuring that all `Deferred` values are `await`ed
9898
once the first one is requested. That means that the previous code behaves
9999
identically to the following, that is, the call `file.await()` implicitly

content/blog/2025-04-21-arrow-2-1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Arrow 2.1.0
33
category: articles
4-
image: https://xebia.com/wp-content/uploads/2023/04/arrow-release-ftr.jpg
4+
image: /img/arrow-release-ftr.jpg
55
no_image_on_post: true
66
tags: [core, articles]
77
---

content/blog/2025-04-22-arrow-intellij-0-3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Arrow plug-in for IntelliJ 0.3
33
category: articles
4-
image: https://xebia.com/wp-content/uploads/2023/04/arrow-release-ftr.jpg
4+
image: /img/arrow-release-ftr.jpg
55
no_image_on_post: true
66
tags: [intellij, articles]
77
---
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
title: Arrow 2.2.0
3+
category: articles
4+
image: /img/arrow-release-ftr.jpg
5+
no_image_on_post: true
6+
tags: [core, articles]
7+
---
8+
9+
# Arrow 2.2.0
10+
11+
Arrow 2.2.0 is out, with improved and new functionality.
12+
This release builds on top of several [new features in Kotlin 2.2](https://kotlinlang.org/docs/whatsnew22.html),
13+
in its self-imposed role of _perfect companion for your Kotlin journey_.
14+
15+
**`Raise` with context parameters.**
16+
The new package `arrow.core.raise.context` provides the same API as `arrow.core.raise`,
17+
but using context parameters instead of extension functions.
18+
This package is intended to be a full 1-1 replacement the extension-based API.
19+
20+
Unfortunately, currently mixing `Raise` functions using extension-style and
21+
context-style doesn't lead to the better experience. Our advice is to fully migrate
22+
to the context-style API if possible, or stay completely within the extension style.
23+
24+
```kotlin
25+
// extension-style
26+
fun Raise<PersonValidationError>.buildPerson(name: String, age: Int): Person { ... }
27+
28+
// context-style, "fake" constructor
29+
context(Raise<PersonValidationError>)
30+
fun Person(name: String, age: Int): Person { ... }
31+
```
32+
33+
:::info Enabling context parameters
34+
35+
In order to define functions with context parameters, you need to enable the
36+
corresponding language feature, as described in the
37+
[Kotlin documentation](https://kotlinlang.org/docs/whatsnew22.html#preview-of-context-parameters).
38+
39+
:::
40+
41+
**New `Racing` DSL for concurrency.**
42+
Arrow Fx provides high-level concurrency combinators
43+
to succinctly describe how tasks should be interleaved in a computation.
44+
Albeit useful, those combinators require nesting and writing your code in a
45+
particular way. In Arrow 2.2.0 we introduce a new
46+
[`Racing` DSL](/learn/coroutines/racing/#racing-dsl-experimental).
47+
Combined with the already existing
48+
[`AwaitAll` DSL](/learn/coroutines/parallel/#await-all--parallelism-experimental),
49+
you can write your coroutines code with little to no changes, while using as
50+
much concurrency as possible during execution.
51+
52+
**`validate` for error values.**
53+
We have introduced a small utility function to bridge the world of validation functions
54+
working on `Raise`, and chained style using `Either` or `Option`. This function is
55+
called `validate`, and it should be commonly used in conjunction with `ensure` and similar functions.
56+
57+
```kotlin
58+
fun failOnMoreConditionsWithBindMap(): Either<String, Int> =
59+
randomNumber()
60+
.validate { ensure(it != 10) { "Number 10 also not allowed" } }
61+
.map { it + 100 }
62+
```
63+
64+
This new function provides no functionality you could not get before.
65+
For example, here is the code equivalent to the one above, but using the `Either` DSL.
66+
67+
```kotlin
68+
fun failOnMoreConditionsWithBindMap(): Either<String, Int> = either {
69+
val random = randomNumber().bind()
70+
ensure(random != 10) { "Number 10 also not allowed" }
71+
random + 100
72+
}
73+
```
74+
75+
We acknowledge that the chain-of-calls style is a common one, and we want the Arrow API
76+
to appeal to users using their preferred style.
77+
78+
**"At most once" for `Eval`.**
79+
Arrow provides the `Eval` type for [fine-grained control over evaluation](/learn/collections-functions/eval/).
80+
This is similar to `lazy` in the standard library, but you can choose
81+
between eager, lazy, and repeated (computed every time) evaluation strategies.
82+
However, there was no (easy) way to ensure that a computation was evaluated
83+
at most once.
84+
85+
The new `Eval.atMostOnce` function (alongside `SuspendEval.atMostOnce`)
86+
provides this new behavior. You should be aware, though, that this means
87+
that getting the value of an `Eval` built this way may block (or suspend)
88+
if more than one thread does so concurrently.
89+
90+
**Changes to `toString` for non-empty collections.**
91+
After a [long discussion in Slack](https://kotlinlang.slack.com/archives/C5UPMM0A0/p1757410910270849)
92+
it became clear that the behavior of `toString` for non-empty collections
93+
should just reflect that of the wrapped collection. Until now, using
94+
`NonEmptyList` or `NonEmptySet` added a prefix — from now on, we treat
95+
non-emptiness as simply a property of the collection, no different than other
96+
such as their size, that are not reflected when turning into a string.
97+
98+
**New `arrow-core-result4k` module.**
99+
[Result4k](https://github.com/fork-handles/forkhandles/tree/trunk/result4k)
100+
is a popular library for computation that may succeed or fail.
101+
We now provide support for it as part of [typed errors](/learn/typed-errors/working-with-typed-errors/).
102+
You can either consume them — that is, `.bind()` a `Result` value —
103+
or produce them — use the `result4k` builder in a similar way to `either`.
104+
105+
**Arrow Optics for Gradle, beta.**
106+
We have been working on a new approach to handle `@optics` annotations
107+
with much less configuration, and that removes the need for manually
108+
writing `companion object`s. This new approach is in beta,
109+
[read here](/community/blog/2025/11/01/arrow-optics-gradle/) all the details.
110+
111+
**Migration to new plug-ins.**
112+
Following our _eager dependency update policy_, we have moved to the new recommended
113+
plug-ins in the ecosystem.
114+
115+
- We now use [KSP2](https://github.com/google/ksp/blob/main/docs/ksp2.md),
116+
- Android now uses the [Android Gradle Library Plugin for KMP](https://developer.android.com/kotlin/multiplatform/plugin),
117+
- Binary validation is done using the [experimental built-in support](https://kotlinlang.org/docs/gradle-binary-compatibility-validation.html),
118+
- We now publish a [version catalog](https://docs.gradle.org/current/userguide/version_catalogs.html#sec:importing-published-catalog)
119+
for consistent versioning of Arrow dependencies.
120+
- The [Arrow plug-in for IntelliJ IDEs](https://plugins.jetbrains.com/plugin/24550-arrow)
121+
now supports up to 2025.3, and understands code using context parameters
122+
and the new `Racing` DSL.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: Arrow Optics for Gradle in beta
3+
category: articles
4+
image: /img/arrow-release-ftr.jpg
5+
no_image_on_post: true
6+
tags: [core, articles]
7+
---
8+
9+
# Introducing Arrow Optics for Gradle
10+
11+
In order to unlock the full power of Arrow Optics, lenses and prisms for your
12+
own types must be defined. This is a tedious task, that can be automate with
13+
the help of the `@optics` annotation. Alas, [setting up](/learn/quickstart/#additional-setup-for-optics)
14+
the plug-in is not easy (especially in Multiplatform projects), and the
15+
architecture of the plugin means that you need to write a `companion object`
16+
explicitly on every one of your types.
17+
18+
We've been working on making this process easier, and the result is the
19+
new [Arrow Optics plugin for Gradle](https://plugins.gradle.org/plugin/io.arrow-kt.optics).
20+
This plugin configures your project to process `@optics` annotations,
21+
taking care of all the peculiarities of Kotlin JVM and Multiplatform plugins.
22+
Furthermore, it sets up the Kotlin compiler to generate `companion object`
23+
automatically (if they are not already present), saving time and boilerplate.
24+
25+
This new plugin is in **beta**, the KSP plugin still remains the officially
26+
supported way to generate optics. But we would also love feedback on the
27+
new approach, with the goal of making this simpler option the default.
28+
If you want to try the new plugin, you need to:
29+
30+
- Remove any previous configuration of the Arrow Optics KSP plugin,
31+
- Add `id("io.arrow-kt.optics") version "2.2.0"` to your `plugins` block,
32+
- Call `arrowOptics()` at the **end** of your `kotlin` block.
33+
34+
```kotlin
35+
plugins {
36+
id("io.arrow-kt.optics") version "2.2.0"
37+
}
38+
39+
kotlin {
40+
// compiler, target, and source set configuration
41+
// ...
42+
arrowOptics()
43+
}
44+
```
45+
46+
Please let us know of any issues you encounter or any feedback on how to
47+
make the process even more approachable, in either our
48+
[issues page](https://github.com/arrow-kt/arrow/issues)
49+
or the `#arrow` channel on [Kotlin Slack](https://slack-chats.kotlinlang.org/c/arrow).

content/blog/authors.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ slorber:
1818

1919
vergauwen_simon:
2020
name: Simon Vergauwen
21-
title: Arrow maintainer & Principal Engineer @ Xebia Functional
21+
title: Arrow maintainer & Developer Advocate @ JetBrains
2222
url: https://github.com/nomisRev
2323
image_url: https://github.com/nomisRev.png
24+
25+
trupill:
26+
name: Alejandro Serrano
27+
title: Arrow maintainer & Language Researcher @ JetBrains
28+
url: https://serranofp.com
29+
image_url: https://github.com/serras.png

0 commit comments

Comments
 (0)