object auto
Module that provides automatic refinements and automatic conversions between refined types (refinement subtyping) at compile-time.
- Source
- auto.scala
- Alphabetic
- By Inheritance
- auto
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
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
-
implicit macro
def
autoInfer[F[_, _], T, A, B](ta: F[T, A])(implicit rt: RefType[F], ir: ==>[A, B]): F[T, B]
Implicitly converts (at compile-time) a value of type
F[T, A]
toF[T, B]
if there is a valid inferenceA ==> B
.Implicitly converts (at compile-time) a value of type
F[T, A]
toF[T, B]
if there is a valid inferenceA ==> B
. If the inference is invalid, compilation fails.Example:
scala> import eu.timepit.refined.api.Refined | import eu.timepit.refined.auto.{ autoInfer, autoRefineV } | import eu.timepit.refined.numeric.Greater scala> val x: Int Refined Greater[W.`5`.T] = 100 scala> x: Int Refined Greater[W.`0`.T] res0: Int Refined Greater[W.`0`.T] = 100
-
implicit macro
def
autoRefineT[T, P](t: T)(implicit rt: RefType[@@], v: Validate[T, P]): @@[T, P]
Implicitly tags (at compile-time) a value of type
T
withP
ift
satisfies the predicateP
.Implicitly tags (at compile-time) a value of type
T
withP
ift
satisfies the predicateP
. If it does not satisfy the predicate, compilation fails.This is an implicit version of
refineMT
. -
implicit macro
def
autoRefineV[T, P](t: T)(implicit rt: RefType[Refined], v: Validate[T, P]): Refined[T, P]
Implicitly wraps (at compile-time) a value of type
T
inapi.Refined[T, P]
ift
satisfies the predicateP
.Implicitly wraps (at compile-time) a value of type
T
inapi.Refined[T, P]
ift
satisfies the predicateP
. If it does not satisfy the predicate, compilation fails.This is an implicit version of
refineMV
. -
implicit
def
autoUnwrap[F[_, _], T, P](tp: F[T, P])(implicit rt: RefType[F]): T
Implicitly unwraps the
T
from a value of typeF[T, P]
using theapi.RefType
instance ofF
.Implicitly unwraps the
T
from a value of typeF[T, P]
using theapi.RefType
instance ofF
. This allows aF[T, P]
to be used as it were a subtype ofT
.Example:
scala> import eu.timepit.refined.auto.autoUnwrap | import eu.timepit.refined.types.numeric.PosInt scala> def plusOne(i: Int): Int = i + 1 | val x = PosInt.unsafeFrom(42) // converts x implicitly to an Int: scala> plusOne(x) res0: Int = 43
Note: This conversion is not needed if
F[T, _] <: T
holds (which is the case forshapeless.tag.@@
, for example). -
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
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( ... ) @native()