compileTime

io.github.iltotore.iron.compileTime
object compileTime

Methods and types to ease compile-time operations.

Attributes

Source
compileTime.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Types

type %[A, B] = NumOp[A, B, %, %, %, %]

Polymorphic modulo.

Polymorphic modulo.

Type parameters

A

the left member of this operation.

B

the right member of this operation.

Attributes

Source
compileTime.scala
type *[A, B] = NumOp[A, B, *, *, *, *]

Polymorphic multiplication.

Polymorphic multiplication.

Type parameters

A

the left member of this operation.

B

the right member of this operation.

Attributes

Source
compileTime.scala
type +[A, B] = (A, B) match { case (String, _$19) => A + ToString[B] case (_$20, String) => ToString[A] + B case Any => NumOp[A, B, +, +, +, +] }

Polymorphic addition.

Polymorphic addition.

Type parameters

A

the left member of this operation.

B

the right member of this operation.

Attributes

Source
compileTime.scala
type -[A, B] = NumOp[A, B, -, -, -, -]

Polymorphic strict subtraction.

Polymorphic strict subtraction.

Type parameters

A

the left member of this operation.

B

the right member of this operation.

Attributes

Source
compileTime.scala
type /[A, B] = NumOp[A, B, /, /, /, /]

Polymorphic division.

Polymorphic division.

Type parameters

A

the left member of this operation.

B

the right member of this operation.

Attributes

Source
compileTime.scala
type <[A, B] = NumOp[A, B, <, <, <, <]

Polymorphic strict inferiority.

Polymorphic strict inferiority.

Type parameters

A

the left member of this operation.

B

the right member of this operation.

Attributes

Source
compileTime.scala
type <=[A, B] = NumOp[A, B, <=, <=, <=, <=]

Polymorphic non-strict inferiority.

Polymorphic non-strict inferiority.

Type parameters

A

the left member of this operation.

B

the right member of this operation.

Attributes

Source
compileTime.scala
type >[A, B] = NumOp[A, B, >, >, >, >]

Polymorphic strict superiority.

Polymorphic strict superiority.

Type parameters

A

the left member of this operation.

B

the right member of this operation.

Attributes

Source
compileTime.scala
type >=[A, B] = NumOp[A, B, >=, >=, >=, >=]

Polymorphic non-strict superiority.

Polymorphic non-strict superiority.

Type parameters

A

the left member of this operation.

B

the right member of this operation.

Attributes

Source
compileTime.scala
type Compatible[A, B] = A match { case Int => B match { case Int => (A, B) case Long => (ToLong[A], B) case Float => (ToFloat[A], B) case Double => (ToDouble[A], B) } case Long => B match { case Int => (A, ToLong[B]) case Long => (A, B) case Float => (ToFloat[A], B) case Double => (ToDouble[A], B) } case Float => B match { case Int => (A, ToFloat[A]) case Long => (A, ToFloat[A]) case Float => (A, B) case Double => (ToDouble[A], B) } case Double => B match { case Int => (A, ToDouble[A]) case Long => (A, ToDouble[A]) case Float => (A, ToDouble[A]) case Double => (A, B) } }

Convert the two given numerical types to the least common parent.

Convert the two given numerical types to the least common parent.

Type parameters

A

the first type to convert.

B

the second type to convert.

Attributes

Source
compileTime.scala
type NumConstant = Int | Long | Float | Double

Attributes

Source
compileTime.scala
type NumOp[A, B, IntOp[_ <: Int, _ <: Int], LongOp[_ <: Long, _ <: Long], FloatOp[_ <: Float, _ <: Float], DoubleOp[_ <: Double, _ <: Double]] = Compatible[A, B] match { case (Int, Int) => IntOp[A, B] case (Long, Long) => LongOp[A, B] case (Float, Float) => FloatOp[A, B] case (Double, Double) => DoubleOp[A, B] }

Polymorphic numerical binary operator. Takes the right implementation according to the least common type of A and B.

Polymorphic numerical binary operator. Takes the right implementation according to the least common type of A and B.

Type parameters

A

the left member of this operation.

B

the right member of this operation.

DoubleOp

the operation to apply if both types can be converted to Double.

FloatOp

the operation to apply if both types can be converted to Float.

IntOp

the operation to apply if both types can be converted to Int.

LongOp

the operation to apply if both types can be converted to Long.

Attributes

Source
compileTime.scala
type ToDouble[A <: NumConstant] = A match { case Int => ToDouble[A] case Long => ToDouble[A] case Float => ToDouble[A] case Double => A & Double }

Polymorphic ToDouble.

Polymorphic ToDouble.

Type parameters

A

the constant type to cast.

Attributes

Source
compileTime.scala
type ToLong[A <: NumConstant] = A match { case Double => ToLong[A] case Float => ToLong[A] case Int => ToLong[A] case Long => A & Long }

Polymorphic ToLong.

Polymorphic ToLong.

Type parameters

A

the constant type to cast.

Attributes

Source
compileTime.scala
type Zero[A] = A match { case Int => 0 case Long => 0L case Float => 0.0f case Double => 0.0d }

The zero number of the given type.

The zero number of the given type.

Type parameters

A

the numerical primitive type.

Attributes

Source
compileTime.scala

Value members

Concrete methods

def applyConstraint[A, C, Impl <: Constraint[A, C]](expr: Expr[A], constraintExpr: Expr[Impl])(using Quotes): Expr[Boolean]

Attributes

Source
compileTime.scala
transparent inline def doubleValue[A <: NumConstant]: Double

Get the Double value of the given type.

Get the Double value of the given type.

Type parameters

A

the type to convert to Double.

Attributes

Returns

the String representation of the given type. Equivalent to constValue[ToDouble[A]].

Source
compileTime.scala
transparent inline def longValue[A <: NumConstant]: Long

Get the Long value of the given type.

Get the Long value of the given type.

Type parameters

A

the type to convert to Long.

Attributes

Returns

the Long representation of the given type. Equivalent to constValue[ToLong[A]].

Source
compileTime.scala
transparent inline def stringValue[A]: String

Get the String value of the given type.

Get the String value of the given type.

Type parameters

A

the type to convert to String.

Attributes

Returns

the String representation of the given type. Equivalent to constValue[ToString[A]].

Source
compileTime.scala