Evidence that states if the conclusion C
can be inferred from the
premise P
or not.
Type class for validating values of type T
according to a type-level
predicate P
.
Type class for validating values of type T
according to a type-level
predicate P
. The semantics of P
are defined by the instance(s) of
this type class for P
.
An abbreviation for shapeless.Witness
.
Module for numeric predicates.
Module for numeric predicates. Predicates that take type parameters
support both shapeless' natural numbers (Nat
) and numeric singleton
types (which are made available by shapeless' Witness
- abbreviated
as W in refined) which include subtypes of Int
, Long
, Double
,
Char
etc.
scala> import shapeless.nat._ | import shapeless.tag.@@ | import eu.timepit.refined.numeric._ scala> refineMT[Greater[_5]](10) res1: Int @@ Greater[_5] = 10 scala> refineMT[Greater[W.`1.5`.T]](1.6) res2: Double @@ Greater[W.`1.5`.T] = 1.6
Macro that returns t
with type T @@ P
if it satisfies the predicate
P
, or fails to compile.
Macro that returns t
with type T @@ P
if it satisfies the predicate
P
, or fails to compile.
scala> import eu.timepit.refined._ | import eu.timepit.refined.numeric._ | import shapeless.tag.@@ scala> refineMT[Positive](10) res1: Int @@ Positive = 10
The return type is internal.RefineM[P, @@]
, which has an
apply
method on it, allowing refineMT
to be called like in the given
example.
Macro that returns t
wrapped in Refined[T, P]
if it satisfies
the predicate P
, or fails to compile.
Macro that returns t
wrapped in Refined[T, P]
if it satisfies
the predicate P
, or fails to compile.
scala> import eu.timepit.refined._ | import eu.timepit.refined.numeric._ scala> refineMV[Positive](10) res1: Refined[Int, Positive] = Refined(10)
The return type is internal.RefineM[P, Refined]
, which has
an apply
method on it, allowing refineMV
to be called like in the
given example.
Returns t
with type T @@ P
on the right if it satisfies the
predicate P
, or an error message on the left otherwise.
Returns t
with type T @@ P
on the right if it satisfies the
predicate P
, or an error message on the left otherwise.
scala> import eu.timepit.refined._ | import eu.timepit.refined.numeric._ | import shapeless.tag.@@ scala> refineT[Positive](10) res1: Either[String, Int @@ Positive] = Right(10)
The return type is internal.Refine[P, @@]
, which has an
apply
method on it, allowing refineT
to be called like in the given
example.
Returns t
wrapped in Refined[T, P]
on the right if it satisfies
the predicate P
, or an error message on the left otherwise.
Returns t
wrapped in Refined[T, P]
on the right if it satisfies
the predicate P
, or an error message on the left otherwise.
scala> import eu.timepit.refined._ | import eu.timepit.refined.numeric._ scala> refineV[Positive](10) res1: Either[String, Refined[Int, Positive]] = Right(Refined(10))
The return type is internal.Refine[P, Refined]
, which has an
apply
method on it, allowing refineV
to be called like in the given
example.
(Since version 0.2.0) refine is deprecated in favor of refineT
(Since version 0.2.0) refineLit is deprecated in favor of refineMT
(Since version 0.2.0) refineM is deprecated in favor of refineMV