eu.timepit.refined

numeric

object numeric extends NumericValidate with NumericInference

Module for numeric predicates. Predicates that take type parameters support both shapeless' natural numbers (Nat) and numeric singleton types (which are made available by shapeless' Witness - abbreviated as W in refined) which include subtypes of Int, Long, Double, Char etc.

Example:

scala> import eu.timepit.refined.api.Refined
     | import eu.timepit.refined.numeric.Greater
     | import shapeless.nat._5

scala> refineMV[Greater[_5]](10)
res1: Int Refined Greater[_5] = 10

scala> refineMV[Greater[W.`1.5`.T]](1.6)
res2: Double Refined Greater[W.`1.5`.T] = 1.6

Note: generic.Equal can also be used for numeric types.

Source
numeric.scala
Linear Supertypes
NumericInference, NumericValidate, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. numeric
  2. NumericInference
  3. NumericValidate
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. type Divisible[N] = Modulo[N, _0]

    Predicate that checks if an integral value is evenly divisible by N.

  2. type Even = Modulo[shapeless.Nat._2, _0]

    Predicate that checks if an integral value is evenly divisible by 2.

  3. final case class Greater[N](n: N) extends Product with Serializable

    Predicate that checks if a numeric value is greater than N.

  4. type GreaterEqual[N] = Not[Less[N]]

    Predicate that checks if a numeric value is greater than or equal to N.

  5. final case class Less[N](n: N) extends Product with Serializable

    Predicate that checks if a numeric value is less than N.

  6. type LessEqual[N] = Not[Greater[N]]

    Predicate that checks if a numeric value is less than or equal to N.

  7. final case class Modulo[N, O](n: N, o: O) extends Product with Serializable

    Predicate that checks if an integral value modulo N is O.

  8. type Negative = Less[_0]

    Predicate that checks if a numeric value is negative (< 0).

  9. type NonDivisible[N] = Not[Divisible[N]]

    Predicate that checks if an integral value is not evenly divisible by N.

  10. type NonNegative = Not[Negative]

    Predicate that checks if a numeric value is zero or positive (>= 0).

  11. type NonPositive = Not[Positive]

    Predicate that checks if a numeric value is zero or negative (<= 0).

  12. type Odd = Not[Even]

    Predicate that checks if an integral value is not evenly divisible by 2.

  13. type Positive = Greater[_0]

    Predicate that checks if a numeric value is positive (> 0).

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. object Interval

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. implicit def greaterInferenceNat[A <: Nat, B <: Nat](implicit ta: ToInt[A], tb: ToInt[B]): ==>[Greater[A], Greater[B]]

    Definition Classes
    NumericInference
  14. implicit def greaterInferenceWit[C, A <: C, B <: C](implicit wa: Aux[A], wb: Aux[B], nc: Numeric[C]): ==>[Greater[A], Greater[B]]

    Definition Classes
    NumericInference
  15. implicit def greaterInferenceWitNat[C, A <: C, B <: Nat](implicit wa: Aux[A], tb: ToInt[B], nc: Numeric[C]): ==>[Greater[A], Greater[B]]

    Definition Classes
    NumericInference
  16. implicit def greaterValidateNat[N <: Nat, T](implicit tn: ToInt[N], wn: Aux[N], nt: Numeric[T]): Plain[T, Greater[N]]

    Definition Classes
    NumericValidate
  17. implicit def greaterValidateWit[T, N <: T](implicit wn: Aux[N], nt: Numeric[T]): Plain[T, Greater[N]]

    Definition Classes
    NumericValidate
  18. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  19. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  20. implicit def lessInferenceNat[A <: Nat, B <: Nat](implicit ta: ToInt[A], tb: ToInt[B]): ==>[Less[A], Less[B]]

    Definition Classes
    NumericInference
  21. implicit def lessInferenceWit[C, A <: C, B <: C](implicit wa: Aux[A], wb: Aux[B], nc: Numeric[C]): ==>[Less[A], Less[B]]

    Definition Classes
    NumericInference
  22. implicit def lessInferenceWitNat[C, A <: C, B <: Nat](implicit wa: Aux[A], tb: ToInt[B], nc: Numeric[C]): ==>[Less[A], Less[B]]

    Definition Classes
    NumericInference
  23. implicit def lessValidateNat[N <: Nat, T](implicit tn: ToInt[N], wn: Aux[N], nt: Numeric[T]): Plain[T, Less[N]]

    Definition Classes
    NumericValidate
  24. implicit def lessValidateWit[T, N <: T](implicit wn: Aux[N], nt: Numeric[T]): Plain[T, Less[N]]

    Definition Classes
    NumericValidate
  25. def moduloValidateNat[N <: Nat, O <: Nat, T](implicit tn: ToInt[N], to: ToInt[O], wn: Aux[N], wo: Aux[O], nt: Numeric[T]): Plain[T, Modulo[N, O]]

    Definition Classes
    NumericValidate
  26. implicit def moduloValidateNatIntegral[N <: Nat, O <: Nat, T](implicit tn: ToInt[N], to: ToInt[O], wn: Aux[N], wo: Aux[O], it: Integral[T]): Plain[T, Modulo[N, O]]

    Definition Classes
    NumericValidate
  27. def moduloValidateWit[T, N <: T, O <: T](implicit wn: Aux[N], wo: Aux[O], nt: Numeric[T]): Plain[T, Modulo[N, O]]

    Definition Classes
    NumericValidate
  28. implicit def moduloValidateWitIntegral[T, N <: T, O <: T](implicit wn: Aux[N], wo: Aux[O], it: Integral[T]): Plain[T, Modulo[N, O]]

    Definition Classes
    NumericValidate
  29. implicit def moduloValidateWitNatIntegral[T, N <: T, O <: Nat](implicit wn: Aux[N], to: ToInt[O], wo: Aux[O], it: Integral[T]): Plain[T, Modulo[N, O]]

    Definition Classes
    NumericValidate
  30. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  31. final def notify(): Unit

    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  33. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  34. def toString(): String

    Definition Classes
    AnyRef → Any
  35. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from NumericInference

Inherited from NumericValidate

Inherited from AnyRef

Inherited from Any

Ungrouped