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 asList[Int :| Positive]
will not fail anymore, even for big sizes.refine
is now deprecated in favor ofrefineUnsafe
- Upgraded
doobie
dependency to1.0.0-RC5
- Minor changes to existing documentation
Adopters
Marss was added to the list of adopters.
Contributors
- @jprudent: #200 and #207
- @matwojcik: #204 and #206
- @rayandfz: #223
- @rlemaitre: #225
Full Changelog: v2.4.0...v2.5.0