These exist in stdlib, but… import compiletime.S type +[A <: Int, B <: Int] <: Int = A match case 0 => B case S[a] => a + S[B] type *[A <: Int, B <: Int] = Mult[A, B, 0] type Mult[A, B, C] <: Int = A match case 0 => C case S[a] => Mult[a, B, B + C] val x: 10 * 11 = 110
Some notes: - yes, it fails if I try to assign numbers other than 110 - compilation is fast - no, it doesn't work for products greater than 10x11