@@ -9,6 +9,12 @@ object deriving {
9
9
/** The mirrored *-type */
10
10
type MirroredMonoType
11
11
12
+ /** The (possibly higher-kinded) mirrored type */
13
+ type MirroredTypeConstructor
14
+
15
+ /** The types of the sum's alternatives or the product's elements */
16
+ type MirroredElemTypes
17
+
12
18
/** The name of the type */
13
19
type MirroredLabel <: String
14
20
}
@@ -17,20 +23,13 @@ object deriving {
17
23
18
24
/** The Mirror for a sum type */
19
25
trait Sum extends Mirror { self =>
20
-
21
- /** The types of the alternatives */
22
- type MirroredElemTypes <: Tuple
23
-
24
26
/** The ordinal number of the case class of `x`. For enums, `ordinal(x) == x.ordinal` */
25
27
def ordinal (x : MirroredMonoType ): Int
26
28
}
27
29
28
30
/** The Mirror for a product type */
29
31
trait Product extends Mirror {
30
32
31
- /** The types of the product elements */
32
- type MirroredElemTypes <: Tuple
33
-
34
33
/** The names of the product elements */
35
34
type MirroredElemLabels <: Tuple
36
35
@@ -40,6 +39,7 @@ object deriving {
40
39
41
40
trait Singleton extends Product {
42
41
type MirroredMonoType = this .type
42
+ type MirroredTypeConstructor = this .type
43
43
type MirroredElemTypes = Unit
44
44
type MirroredElemLabels = Unit
45
45
def fromProduct (p : scala.Product ) = this
@@ -48,14 +48,15 @@ object deriving {
48
48
/** A proxy for Scala 2 singletons, which do not inherit `Singleton` directly */
49
49
class SingletonProxy (val value : AnyRef ) extends Product {
50
50
type MirroredMonoType = value.type
51
+ type MirroredTypeConstructor = value.type
51
52
type MirroredElemTypes = Unit
52
53
type MirroredElemLabels = Unit
53
54
def fromProduct (p : scala.Product ) = value
54
55
}
55
56
56
- type Of [T ] = Mirror { type MirroredMonoType = T }
57
- type ProductOf [T ] = Mirror .Product { type MirroredMonoType = T }
58
- type SumOf [T ] = Mirror .Sum { type MirroredMonoType = T }
57
+ type Of [T ] = Mirror { type MirroredMonoType = T ; type MirroredElemTypes <: Tuple }
58
+ type ProductOf [T ] = Mirror .Product { type MirroredMonoType = T ; type MirroredElemTypes <: Tuple }
59
+ type SumOf [T ] = Mirror .Sum { type MirroredMonoType = T ; type MirroredElemTypes <: Tuple }
59
60
}
60
61
61
62
/** Helper class to turn arrays into products */
0 commit comments