object numeric extends NumericInference
Module for numeric predicates.
Int
literals, Double
literals for fractional base types, or
literals of the base type can be used as arguments in predicates
that have type parameters.
Example:
scala> import eu.timepit.refined.api.Refined | import eu.timepit.refined.numeric.{Greater, LessEqual} scala> refineV[Greater[W.`5`.T]](BigInt(10)) res1: Either[String, BigInt Refined Greater[W.`5`.T]] = Right(10) scala> refineV[LessEqual[W.`1.5`.T]](1.4) res2: Either[String, Double Refined LessEqual[W.`1.5`.T]] = Right(1.4)
Note: generic.Equal
can also be used for numeric types.
- Source
- numeric.scala
- Alphabetic
- By Inheritance
- numeric
- NumericInference
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
type
Divisible[N] = Modulo[N, _0]
Predicate that checks if an integral value is evenly divisible by
N
. -
type
Even = Modulo[shapeless.Nat._2, _0]
Predicate that checks if an integral value is evenly divisible by 2.
-
final
case class
Greater[N](n: N) extends Product with Serializable
Predicate that checks if a numeric value is greater than
N
. -
type
GreaterEqual[N] = Not[Less[N]]
Predicate that checks if a numeric value is greater than or equal to
N
. -
final
case class
Less[N](n: N) extends Product with Serializable
Predicate that checks if a numeric value is less than
N
. -
type
LessEqual[N] = Not[Greater[N]]
Predicate that checks if a numeric value is less than or equal to
N
. -
final
case class
Modulo[N, O](n: N, o: O) extends Product with Serializable
Predicate that checks if an integral value modulo
N
isO
. -
type
Negative = Less[_0]
Predicate that checks if a numeric value is negative (< 0).
-
type
NonDivisible[N] = Not[Divisible[N]]
Predicate that checks if an integral value is not evenly divisible by
N
. -
final
case class
NonNaN() extends Product with Serializable
Predicate that checks if a floating-point number value is not NaN.
-
type
NonNegative = Not[Negative]
Predicate that checks if a numeric value is zero or positive (>= 0).
-
type
NonPositive = Not[Positive]
Predicate that checks if a numeric value is zero or negative (<= 0).
-
type
Odd = Not[Even]
Predicate that checks if an integral value is not evenly divisible by 2.
-
type
Positive = Greater[_0]
Predicate that checks if a numeric value is positive (> 0).
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[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()
-
implicit
def
greaterEqualInference[A]: ==>[Greater[A], GreaterEqual[A]]
- Definition Classes
- NumericInference
-
implicit
def
greaterInference[C, A, B](implicit wa: WitnessAs[A, C], wb: WitnessAs[B, C], nc: Numeric[C]): ==>[Greater[A], Greater[B]]
- Definition Classes
- NumericInference
-
implicit
def
greaterInferenceNat[A <: Nat, B <: Nat](implicit ta: ToInt[A], tb: ToInt[B]): ==>[Greater[A], Greater[B]]
- Definition Classes
- NumericInference
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
implicit
def
lessEqualInference[A]: ==>[Less[A], LessEqual[A]]
- Definition Classes
- NumericInference
-
implicit
def
lessInference[C, A, B](implicit wa: WitnessAs[A, C], wb: WitnessAs[B, C], nc: Numeric[C]): ==>[Less[A], Less[B]]
- Definition Classes
- NumericInference
-
implicit
def
lessInferenceNat[A <: Nat, B <: Nat](implicit ta: ToInt[A], tb: ToInt[B]): ==>[Less[A], Less[B]]
- Definition Classes
- NumericInference
-
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()
- object Greater extends Serializable
- object Interval
- object Less extends Serializable
- object Modulo extends Serializable
- object NonNaN extends Serializable