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.
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].refineMF[Long, Positive](10) res0: Refined[Long, Positive] = 10
Note: M stands for macro and F for fully applied.
Note: The return type is internal.RefineMFullyApplied[F, T, P],
which has an apply method on it, allowing refineMF to be called
like in the given example. In contrast to refineM, the type
T needs to be specified before apply can be called.
Type class that allows
Fto be used as carrier type of a refinement. The first type parameter ofFis 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
RefTypeforRefinedvalue classshapeless.tag.@@which is a subtype of its first parameter (i.e.(T @@ P) <: T)