A library is more robust if it plays well with the rest of the ecosystem surrounding it. Arrow integrates with many useful libraries in the Kotlin ecosystem. This is a non-exhaustive list, and we're happy to hear about support for Arrow from other libraries.
Do you maintain or know of a library with support for Arrow? Feel free to open an issue in the repository, and we'll add it to this list. Thanks in advance! 🤩
There's a custom set of rules for Detekt that can help you refine your style when using Arrow.
Testing​
Kotest​
If you want to test the result of a function that uses a type defined in Arrow,
like Either
, you can use the matchers
extension library. If you're using property-based testing (you should!), you can
use generators
for Arrow types.
AssertJ​
Assertions covering Either
and Option
are provided by
this library.
Serialization​
See the corresponding section.
Configuration​
Hoplite​
Hoplite is a great library for handling configurations and supporting various sources, formats, and cascading setups. The library supports most Arrow types for decoding.
Validation​
Akkurate​
Akkurate provides a language to describe complex validation code. It provides integration with Arrow's typed error mechanism.
HTTP​
Retrofit​
If Retrofit is your library of choice for querying HTTP services, this small integration module may come in quite handy.
Ktor​
Serialization​
If you're using kotlinx.serialization, you need no further changes other than
importing the serializers with @UseSerializers
.
If you want to use Arrow Core types directly as your request or response models, you will need to include the ArrowModule
in your serializers module:
install(ContentNegotiation) {
json(Json {
serializersModule = ArrowModule
})
}
If you're using Jackson, you can use a custom mapper,
and pass it to the ContentNegotiation
configuration.
object JsonMapper {
val mapper: ObjectMapper = ObjectMapper()
.registerModule(KotlinModule(singletonSupport = SingletonSupport.CANONICALIZE))
.registerArrowModule()
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.disable(JsonParser.Feature.INCLUDE_SOURCE_IN_LOCATION)
.setSerializationInclusion(JsonInclude.Include.NON_ABSENT)
}
install(ContentNegotiation) {
register(ContentType.Application.Json, JacksonConverter(JsonMapper.mapper))
}
Resilience​
The arrow-resilience-ktor-client
module provides Ktor client plug-ins for retry/repeat and circuit breakers based on Arrow's.
kJWT​
This library adds support for JSON Web Signatures and JSON Web Tokens to the Kotlin and Arrow ecosystems.
Caching​
cache4k​
You can easily integrate cache4k as caching mechanism for memoization.