Skip to content

v2.5.0

Latest
Compare
Choose a tag to compare
@Iltotore Iltotore released this 03 Mar 10:05
· 5 commits to main since this release
8a88093

Introduction

This release adds support for several libraries and other minor features.

Main changes

First order types support

Iron now provides refinement methods for first order types:

List(1, 2, 3).refineAllOption[Positive]  //Some(List(1, 2, 3)): List[Int :| Positive]
List(-1, 2, 3).refineAllOption[Positive] //None

Such methods exist for:

  • Imperative (refine/refineUnsafe)
  • Option
  • Either
  • "Further" equivalents

Borer support

Iron now supports Borer's codec derivation:

type Username = String :| DescribedAs[Not[Blank], "Username must not be blank"]
type Age = Int :| DescribedAs[Positive, "Age must be positive"]

case class User(name: String :| Not[Blank], age: Int :| Positive) derives Codec

Json.decode("""{"name":"hey","age":25}""".getBytes).to[User] //Right(...)
Json.decode("""{"name":"","age":25}""".getBytes).to[User] //Left(ValidationFailure("Username must not be blank"))

Other changes

  • Gen/Arbitrary instances for types such as List[Int :| Positive] will not fail anymore, even for big sizes.
  • refine is now deprecated in favor of refineUnsafe
  • Upgraded doobie dependency to 1.0.0-RC5
  • Minor changes to existing documentation

Adopters

Marss was added to the list of adopters.

Contributors

Full Changelog: v2.4.0...v2.5.0