trait RefType[F[_, _]] extends Serializable
Type class that allows F to be used as carrier type of a refinement.
The first type parameter of F 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 type T.
The library provides instances of RefType for
- the
Refinedvalue class - and
shapeless.tag.@@which is a subtype of its first parameter (i.e.(T @@ P) <: T)
- Source
- RefType.scala
- Alphabetic
- By Inheritance
- RefType
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
- abstract def unsafeRewrap[T, A, B](ta: F[T, A]): F[T, B]
- abstract def unsafeRewrapM[T, A, B](c: Context)(ta: scala.reflect.macros.blackbox.Context.Expr[F[T, A]])(implicit arg0: scala.reflect.macros.blackbox.Context.WeakTypeTag[T], arg1: scala.reflect.macros.blackbox.Context.WeakTypeTag[A], arg2: scala.reflect.macros.blackbox.Context.WeakTypeTag[B]): scala.reflect.macros.blackbox.Context.Expr[F[T, B]]
- abstract def unsafeWrap[T, P](t: T): F[T, P]
- abstract def unsafeWrapM[T, P](c: Context)(t: scala.reflect.macros.blackbox.Context.Expr[T])(implicit arg0: scala.reflect.macros.blackbox.Context.WeakTypeTag[T], arg1: scala.reflect.macros.blackbox.Context.WeakTypeTag[P]): scala.reflect.macros.blackbox.Context.Expr[F[T, P]]
- abstract def unwrap[T](tp: F[T, _]): T
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- def coflatMapRefine[T, P, U](tp: F[T, P])(f: (F[T, P]) ⇒ U)(implicit v: Validate[U, P]): Either[String, F[U, P]]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def mapRefine[T, P, U](tp: F[T, P])(f: (T) ⇒ U)(implicit v: Validate[U, P]): Either[String, F[U, P]]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
refine[P]: RefinePartiallyApplied[F, P]
Returns a value of type
Trefined asF[T, P]on the right if it satisfies the predicateP, or an error message on the left otherwise.Returns a value of type
Trefined asF[T, P]on the right if it satisfies the predicateP, 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 anapplymethod on it, allowing the typeTto be inferred from its argument. -
def
refineM[P]: RefineMPartiallyApplied[F, P]
Macro that returns a value of type
Trefined asF[T, P]if it satisfies the predicateP, or fails to compile otherwise.Macro that returns a value of type
Trefined asF[T, P]if it satisfies the predicateP, 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:
Mstands for macro.Note: The return type is
internal.RefineMPartiallyApplied[F, P], which has anapplymethod on it, allowing the typeTto be inferred from its argument. -
def
refineMF[T, P]: RefineMFullyApplied[F, T, P]
Macro that returns a value of type
Trefined asF[T, P]if it satisfies the predicateP, or fails to compile otherwise.Macro that returns a value of type
Trefined asF[T, P]if it satisfies the predicateP, 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:
Mstands for macro andFfor fully applied.Note: The return type is
internal.RefineMFullyApplied[F, T, P], which has anapplymethod on it, allowingrefineMFto be called like in the given example. In contrast torefineM, the typeTneeds to be specified beforeapplycan be called. -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )