Object

eu.timepit.refined

numeric

Related Doc: package refined

Permalink

object numeric extends 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, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. numeric
  2. NumericInference
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

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

    Permalink

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

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

    Permalink

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

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

    Permalink

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

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

    Permalink

    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

    Permalink

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

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

    Permalink

    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

    Permalink

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

  8. type Negative = Less[_0]

    Permalink

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

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

    Permalink

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

  10. final case class NonNaN() extends Product with Serializable

    Permalink

    Predicate that checks if a floating-point number value is not NaN.

  11. type NonNegative = Not[Negative]

    Permalink

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

  12. type NonPositive = Not[Positive]

    Permalink

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

  13. type Odd = Not[Even]

    Permalink

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

  14. type Positive = Greater[_0]

    Permalink

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

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. object Greater extends Serializable

    Permalink
  5. object Interval

    Permalink
  6. object Less extends Serializable

    Permalink
  7. object Modulo extends Serializable

    Permalink
  8. object NonNaN extends Serializable

    Permalink
  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. def clone(): AnyRef

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  15. implicit def greaterEqualInference[A]: ==>[Greater[A], GreaterEqual[A]]

    Permalink
    Definition Classes
    NumericInference
  16. implicit def greaterInference[C, A, B](implicit wa: WitnessAs[A, C], wb: WitnessAs[B, C], nc: Numeric[C]): ==>[Greater[A], Greater[B]]

    Permalink
    Definition Classes
    NumericInference
  17. implicit def greaterInferenceNat[A <: Nat, B <: Nat](implicit ta: ToInt[A], tb: ToInt[B]): ==>[Greater[A], Greater[B]]

    Permalink
    Definition Classes
    NumericInference
  18. def hashCode(): Int

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

    Permalink
    Definition Classes
    Any
  20. implicit def lessEqualInference[A]: ==>[Less[A], LessEqual[A]]

    Permalink
    Definition Classes
    NumericInference
  21. implicit def lessInference[C, A, B](implicit wa: WitnessAs[A, C], wb: WitnessAs[B, C], nc: Numeric[C]): ==>[Less[A], Less[B]]

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

    Permalink
    Definition Classes
    NumericInference
  23. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  24. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. final def notifyAll(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  27. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from NumericInference

Inherited from AnyRef

Inherited from Any

Ungrouped