constraint

object constraint
class Object
trait Matchable
class Any

Type members

Classlikes

trait Divisible[V]

Constraint: checks if the input value is divisible by V

Constraint: checks if the input value is divisible by V

class DivisibleConstraint[A <: Number, V <: A] extends Constraint[A, Divisible[V]]
trait Greater[V]

Constraint: checks if the input value is greater than V.

Constraint: checks if the input value is greater than V.

class GreaterConstraint[A <: Number, V <: A] extends Constraint[A, Greater[V]]
trait GreaterEqual[V]

Constraint: checks if the input value is greater or equal to V.

Constraint: checks if the input value is greater or equal to V.

class GreaterEqualConstraint[A <: Number, V <: A] extends Constraint[A, GreaterEqual[V]]
trait Less[V]

Constraint: checks if the input value is less than V.

Constraint: checks if the input value is less than V.

class LessConstraint[A <: Number, V <: A] extends Constraint[A, Less[V]]
trait LessEqual[V]

Constraint: checks if the input value is less or equal to V.

Constraint: checks if the input value is less or equal to V.

class LessEqualConstraint[A <: Number, V <: A] extends Constraint[A, LessEqual[V]]

Types

type %[A, B] = Constrained[A, Divisible[B]]
type <[A, B] = Constrained[A, Less[B]]
type <=[A, B] = Constrained[A, LessEqual[B]]
type >[A, B] = Constrained[A, Greater[B]]
type >=[A, B] = Constrained[A, GreaterEqual[B]]
type Even[T] = Constrained[T, T match { case Byte => Divisible[2] case Short => Divisible[2] case Int => Divisible[2] case Long => Divisible[2L] }]

Alias for T % 2. Supports all non-floating primitives.

Alias for T % 2. Supports all non-floating primitives.

Type Params
T

the primitive's type.

type Natural[T] = T >= T match { case Byte => GreaterEqual[0] case Short => GreaterEqual[0] case Int => GreaterEqual[0] case Long => GreaterEqual[0L] }

Alias for T >= 0. Supports all non-floating primitives.

Alias for T >= 0. Supports all non-floating primitives.

Type Params
T

the primitive's type.

type Natural1[T] = Constrained[T, T match { case Byte => Greater[0] case Short => Greater[0] case Int => Greater[0] case Long => Greater[0L] }]

Alias for T > 0. Supports all non-floating primitives.

Alias for T > 0. Supports all non-floating primitives.

Type Params
T

the primitive's type.

Givens

Givens

given DivisibleConstraint_A_V: Constraint[A, Divisible[V]]
given GreaterConstraint_A_V: Constraint[A, Greater[V]]
given GreaterEqualConstraint_A_V: Constraint[A, GreaterEqual[V]]
given LessConstraint_A_V: Constraint[A, Less[V]]
given LessEqualConstraint_A_V: Constraint[A, LessEqual[V]]