refined icon indicating copy to clipboard operation
refined copied to clipboard

Experiment: refine macro in Scala 3

Open fthomas opened this issue 3 years ago • 1 comments

This works with inline type classes and conditions that can be evaluated at compile-time like >, !, and ==:

scala> refineMV[Int, Positive1](5)
val res1: eu.timepit.refined.api.Refined[Int, eu.timepit.refined.Positive1] = 5

scala> refineMV[Int, Positive1](-5)
1 |refineMV[Int, Positive1](-5)
  |^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |no

scala> refineMV[String, NonEmpty1]("hello")
val res2: eu.timepit.refined.api.Refined[String, eu.timepit.refined.NonEmpty1] = hello

scala> refineMV[String, NonEmpty1]("")
1 |refineMV[String, NonEmpty1]("")
  |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |no

fthomas avatar Mar 07 '21 20:03 fthomas

Codecov Report

Merging #921 (b3ed76d) into master (98aff1d) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #921   +/-   ##
=======================================
  Coverage   92.39%   92.39%           
=======================================
  Files          63       63           
  Lines         815      815           
  Branches        6        6           
=======================================
  Hits          753      753           
  Misses         62       62           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 98aff1d...b3ed76d. Read the comment docs.

codecov[bot] avatar Mar 07 '21 20:03 codecov[bot]