Returns a value of type T
refined as F[T, P]
on the right if
it satisfies the predicate P
, or an error message on the left
otherwise.
Returns a value of type T
refined as F[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.api.{ Refined, RefType } | import eu.timepit.refined.numeric.Positive scala> RefType[Refined].refine[Positive](10) res0: Either[String, Refined[Int, Positive]] = Right(10)
Note: The return type is internal.RefinePartiallyApplied[F, P]
,
which has an apply
method on it, allowing the type T
to be
inferred from its argument.
Macro that returns a value of type T
refined as F[T, P]
if
it satisfies the predicate P
, or fails to compile otherwise.
Macro that returns a value of type T
refined as F[T, P]
if
it satisfies the predicate P
, or fails to compile otherwise.
Example:
scala> import eu.timepit.refined.api.{ Refined, RefType } | import eu.timepit.refined.numeric.Positive scala> RefType[Refined].refineM[Positive](10) res0: Refined[Int, Positive] = 10
Note: M
stands for macro.
Note: The return type is internal.RefineMPartiallyApplied[F, P]
,
which has an apply
method on it, allowing the type T
to be
inferred from its argument.
(Since version 0.9.1)
Type class that allows
F
to be used as carrier type of a refinement. The first type parameter ofF
is the base type that is being refined by its second type parameter which is the type-level predicate that denotes the refinement. Consequently,F[T, P]
is a phantom type that only contains a value of typeT
.The library provides instances of
RefType
forRefined
value classshapeless.tag.@@
which is a subtype of its first parameter (i.e.(T @@ P) <: T
)