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
.
Wraps a value of type T
that satisfies the predicate P
.
This object was generated by sbt-buildinfo.
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.
Example:
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.
Example:
scala> import eu.timepit.refined._ | import eu.timepit.refined.numeric._ | import shapeless.tag.@@ scala> refineMT[Positive](10) res1: Int @@ Positive = 10
Note: M
stands for macro and T
stands for tag.
Note: The return type is internal.RefineMAux[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.
Example:
scala> import eu.timepit.refined._ | import eu.timepit.refined.numeric._ scala> refineMV[Positive](10) res1: Refined[Int, Positive] = Refined(10)
Note: M
stands for macro and V
stands for value class.
Note: The return type is internal.RefineMAux[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.
Example:
scala> import eu.timepit.refined._ | import eu.timepit.refined.numeric._ | import shapeless.tag.@@ scala> refineT[Positive](10) res1: Either[String, Int @@ Positive] = Right(10)
Note: T
stands for tag.
Note: The return type is internal.RefineAux[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.
Example:
scala> import eu.timepit.refined._ | import eu.timepit.refined.numeric._ scala> refineV[Positive](10) res1: Either[String, Refined[Int, Positive]] = Right(Refined(10))
Note: V
stands for value class.
Note: The return type is internal.RefineAux[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