v3.2.0
Introduction
This release introduces RefinedSubtype having the behavior of pre-3.0.2 RefinedType:
- Use
RefinedTypefor fully opaque new types - Use
RefinedSubtypefor new types that are subtypes of their inner type e.gPosInt <: Int
RefinedSubtype also provides RefinedType.Mirror instance and benefits from all existing givens for RefinedType.
import io.github.iltotore.iron.*
import io.github.iltotore.iron.constraint.numeric.Positive
import io.github.iltotore.
import zio.json.*
type PosInt = PosInt.T
object PosInt extends RefinedSubtype[Int, Positive]
val x: PosInt = PosInt(5)
val y: Int = x
val z = "5".fromJson[PosInt]
Minor breaking change
The type of RefinedType.Mirror#ops now is Refined[A, C] (Refined is either a RefinedType or RefinedSubtype) instead of RefinedType[A, C]. They have the exact same methods so the chance any source breaks is minimal and the fix trivial.
Contributors
- @AlterEgo7: #341
- @Hombre-x: #340
Full Changelog: https://github.com/Iltotore/iron/compare/v3.1.0...v3.2.0