Skip to content

0.2.1 - Tracks Hearth 0.4.1

Latest

Choose a tag to compare

@MateuszKubuszok MateuszKubuszok released this 14 Jul 07:32
aaf48b6

The third release of refined-compat — compile-time refinement validation for refined types on both Scala 2.13 and Scala 3, powered by Hearth's Expr.semiEval.

Like 0.2.0, this is a maintenance release. There are no source or API changes since 0.2.0 — every public entry point (hearth.refined.auto._, refineMV, RefinedTypeOpsM) and the full predicate coverage behave exactly as before. What changed is underneath: refined-compat now tracks Hearth 0.4.1 and picks up routine toolchain and dependency bumps. If you are upgrading, this is a drop-in bump (MiMa is enabled against 0.2.0 and green).

import hearth.refined.auto._

val x: Int Refined Positive = 5     // compiles on both Scala 2.13 and 3
val y: String Refined NonEmpty = "" // fails at compile time on both

Highlights

  • Now tracks Hearth 0.4.1 — a pure dependency bump. The 0.4.1 line (Chimney-migration hardening, a compile-time-performance pass, and small new APIs) is source- and binary-compatible with refined-compat, so no library code had to change. refined-compat continues to double as a real-world semiEval feedback project for Hearth.
  • Toolchain & dependencies — sbt bumped to 2.0.1, refined to 0.11.4, munit to 1.3.4, scalafmt-core to 3.11.3, and the stale sbt-1.x Scala Steward pin dropped.
  • Binary compatibility — MiMa is now enabled against 0.2.0 and passes on the public API.

How it works

Unchanged from 0.1.0: Hearth's semiEval reconstructs both the literal value and the Validate[T, P] (or Inference[A, B]) instance from the expression AST at macro-expansion time, runs the validation, and either emits Refined.unsafeApply(value) or aborts compilation with the predicate's error message. No c.eval needed — which is exactly why it works on Scala 3.

Summary

A maintenance release: same API and same predicate coverage as 0.2.0, now built on Hearth 0.4.1. Still published for Scala 2.13 and Scala 3 (3.3 LTS) on JVM, Scala.js, and Scala Native. Replace eu.timepit.refined.auto._ with hearth.refined.auto._ and you're done.

Star the project ⭐ and leave us some feedback!