Changes
-
Added inference rules to enable automatic conversions between different
refined types (in the absent of any subtype relation). For example, a value
of typeInt @@ Greater[_5]
can be safely converted to anInt @@ Positive
,
but the reverse is not true:scala> refineLit[Greater[_5]](10) res1: Int @@ Greater[_5] = 10 scala> res1: Int @@ Positive res2: Int @@ Positive = 10 scala> res2: Int @@ Greater[_5] <console>:42: error: invalid inference: Positive ==> Greater[_5] res2: Int @@ Greater[_5] ^
Note that these conversions need to be enabled with an import:
import eu.timepit.refined.implicits._
-
Added an implicit version of
refineLit
to theimplicits
object.
This allows to writeval a: Char @@ Digit = '4'
instead of
val a: Char @@ Digit = refineLit('4')
-
Made
Predicate
serializable. -
Removed
IsNull
andNonNull
predicates since they often caused ambiguous
implicit errors and Scala has better means to handlenull
values.
Bug fixes
refineLit
always required a prior import ofshapeless.tag.@@
. (9f6d7d9)- Changed build to multi-project build so that tut-core is not added as
dependency to refined. (#17)
New predicates
NonPositive
: checks if a numeric value is zero or negativeNonNegative
: checks if a numeric value is zero or positive
EndsWith[S]
: checks if aString
ends with the suffixS
Regex
: checks if aString
is a valid regular expressionStartsWith[S]
: checks if aString
starts with the prefixS
Released on 2015-06-20