-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathMath.scala
90 lines (77 loc) · 3.94 KB
/
Math.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package singleton.ops
import singleton.ops.impl.OpMacro
object Math {
trait NumericLiteral[T, UB]
implicit def __numericIsNumeric[T, UB]: OpInterceptAux[NumericLiteral[T, UB] => NumericLiteral[_,_], NumericLiteral[T, UB]] = ???
implicit def __numericInt[T <: XInt] : OpInterceptAux[T => NumericLiteral[_,_], NumericLiteral[T, XInt]] = ???
implicit def __numericLong[T <: XLong] : OpInterceptAux[T => NumericLiteral[_,_], NumericLiteral[T, XLong]] = ???
implicit def __numericFloat[T <: XFloat] : OpInterceptAux[T => NumericLiteral[_,_], NumericLiteral[T, XFloat]] = ???
implicit def __numericDouble[T <: XDouble] : OpInterceptAux[T => NumericLiteral[_,_], NumericLiteral[T, XDouble]] = ???
trait IntegralLiteral[T, UB] extends NumericLiteral[T, UB]
implicit def __integralInt[T] : OpInterceptAux[NumericLiteral[T, XInt] => IntegralLiteral[_,_], IntegralLiteral[T, XInt]] = ???
implicit def __integralLong[T] : OpInterceptAux[NumericLiteral[T, XLong] => IntegralLiteral[_,_], IntegralLiteral[T, XLong]] = ???
trait Zero
implicit def __zeroInt : OpInterceptAux[Zero => XInt, W.`0`.T] = ???
implicit def __zeroLong : OpInterceptAux[Zero => XLong, W.`0L`.T] = ???
implicit def __zeroFloat : OpInterceptAux[Zero => XFloat, W.`0.0f`.T] = ???
implicit def __zeroDouble : OpInterceptAux[Zero => XDouble, W.`0.0`.T] = ???
// implicit def `__numeric+`[L, NL[_,_], TL, R, NR[_,_], TR, UB](
// implicit
// numericL : OpInterceptAux[L => NumericLiteral[_,_], NL[TL, UB]],
// numericR : OpInterceptAux[R => NumericLiteral[_,_], NR[TR, UB]],
// op : TL + TR
// ) : OpInterceptAux[L + R, NumericLiteral[op.Out, UB]] = ???
//
// implicit def `__numeric-`[L, NL[_,_], TL, R, NR[_,_], TR, UB](
// implicit
// numericL : OpInterceptAux[L => NumericLiteral[_,_], NL[TL, UB]],
// numericR : OpInterceptAux[R => NumericLiteral[_,_], NR[TR, UB]],
// op : TL - TR
// ) : OpInterceptAux[L - R, NumericLiteral[op.Out, UB]] = ???
//
// implicit def `__numeric*`[L, NL[_,_], TL, R, NR[_,_], TR, UB](
// implicit
// numericL : OpInterceptAux[L => NumericLiteral[_,_], NL[TL, UB]],
// numericR : OpInterceptAux[R => NumericLiteral[_,_], NR[TR, UB]],
// op : TL * TR
// ) : OpInterceptAux[L * R, NumericLiteral[op.Out, UB]] = ???
//
// implicit def `__numeric/`[L, NL[_,_], TL, R, NR[_,_], TR, UB](
// implicit
// numericL : OpInterceptAux[L => IntegralLiteral[_,_], NL[TL, UB]],
// numericR : OpInterceptAux[R => IntegralLiteral[_,_], NR[TR, UB]],
// op : TL / TR
// ) : OpInterceptAux[L / R, IntegralLiteral[op.Out, UB]] = ???
//
// implicit def `__numeric%`[L, NL[_,_], TL, R, NR[_,_], TR, UB](
// implicit
// numericL : OpInterceptAux[L => IntegralLiteral[_,_], NL[TL, UB]],
// numericR : OpInterceptAux[R => IntegralLiteral[_,_], NR[TR, UB]],
// op : TL % TR
// ) : OpInterceptAux[L % R, IntegralLiteral[op.Out, UB]] = ???
// trait IsPositiveLiteral[T]
// implicit def __isPositive[T](
// implicit
// positive : T > ZeroLiteralOf[T]
// ) : OpInterceptAux[IsPositiveLiteral[T], positive.Out] = ???
//
// trait PositiveLiteral[T] extends NumericLiteral[T]
// implicit def __positiveNumeric[T](
// implicit
// positive : RequireMsg[IsPositiveLiteral[T], W.`"Must be a positive number, but found "`.T + ToString[T]]
// ) : OpInterceptAux[NumericLiteral[T] => PositiveLiteral[_], PositiveLiteral[T]] = ???
// trait IsNegativeOpId
// type IsNegative[P] = OpMacro[IsNegativeOpId, P, W.`0`.T, W.`0`.T]
// implicit def doIsNegative[P](implicit
// tst: P < AlignType[0, P]): OpInterceptAux[IsNegative[P], tst.Out] = ???
//
// trait IsZeroOpId
// type IsZero[P] = OpMacro[IsZeroOpId, P, W.`0`.T, W.`0`.T]
// implicit def doIsZero[P](implicit
// tst: P == AlignType[0, P]): OpInterceptAux[IsZero[P], tst.Out] = ???
//
// trait IsNonZeroOpId
// type IsNonZero[P] = OpMacro[IsNonZeroOpId, P, W.`0`.T, W.`0`.T]
// implicit def doIsNonZero[P](implicit
// tst: P != AlignType[0, P]): OpInterceptAux[IsNonZero[P], tst.Out] = ???
}