@@ -14,22 +14,16 @@ abstract class Liftable[T] {
14
14
*/
15
15
object Liftable {
16
16
17
- sealed abstract class PrimitiveExpr [T ] extends Expr [T ] {
18
- def value : T
19
- }
17
+ final class ConstantExpr [T ] private [Liftable ](val value : T ) extends Expr [T ]
20
18
21
- private class ValueExpr [T <: AnyVal ](val value : T ) extends PrimitiveExpr [T ]
19
+ implicit def BooleanIsLiftable : Liftable [Boolean ] = (x : Boolean ) => new ConstantExpr (x)
20
+ implicit def ByteLiftable : Liftable [Byte ] = (x : Byte ) => new ConstantExpr (x)
21
+ implicit def CharIsLiftable : Liftable [Char ] = (x : Char ) => new ConstantExpr (x)
22
+ implicit def ShortIsLiftable : Liftable [Short ] = (x : Short ) => new ConstantExpr (x)
23
+ implicit def IntIsLiftable : Liftable [Int ] = (x : Int ) => new ConstantExpr (x)
24
+ implicit def LongIsLiftable : Liftable [Long ] = (x : Long ) => new ConstantExpr (x)
25
+ implicit def FloatIsLiftable : Liftable [Float ] = (x : Float ) => new ConstantExpr (x)
26
+ implicit def DoubleIsLiftable : Liftable [Double ] = (x : Double ) => new ConstantExpr (x)
22
27
23
- implicit def BooleanIsLiftable : Liftable [Boolean ] = (x : Boolean ) => new ValueExpr (x)
24
- implicit def ByteLiftable : Liftable [Byte ] = (x : Byte ) => new ValueExpr (x)
25
- implicit def CharIsLiftable : Liftable [Char ] = (x : Char ) => new ValueExpr (x)
26
- implicit def ShortIsLiftable : Liftable [Short ] = (x : Short ) => new ValueExpr (x)
27
- implicit def IntIsLiftable : Liftable [Int ] = (x : Int ) => new ValueExpr (x)
28
- implicit def LongIsLiftable : Liftable [Long ] = (x : Long ) => new ValueExpr (x)
29
- implicit def FloatIsLiftable : Liftable [Float ] = (x : Float ) => new ValueExpr (x)
30
- implicit def DoubleIsLiftable : Liftable [Double ] = (x : Double ) => new ValueExpr (x)
31
-
32
- private class StringExpr (val value : String ) extends PrimitiveExpr [String ]
33
-
34
- implicit def StringIsLiftable : Liftable [String ] = (x : String ) => new StringExpr (x)
28
+ implicit def StringIsLiftable : Liftable [String ] = (x : String ) => new ConstantExpr (x)
35
29
}
0 commit comments