@@ -9,6 +9,12 @@ object deriving {
99 /** The mirrored *-type */
1010 type MirroredMonoType
1111
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+
1218 /** The name of the type */
1319 type MirroredLabel <: String
1420 }
@@ -17,20 +23,13 @@ object deriving {
1723
1824 /** The Mirror for a sum type */
1925 trait Sum extends Mirror { self =>
20-
21- /** The types of the alternatives */
22- type MirroredElemTypes <: Tuple
23-
2426 /** The ordinal number of the case class of `x`. For enums, `ordinal(x) == x.ordinal` */
2527 def ordinal (x : MirroredMonoType ): Int
2628 }
2729
2830 /** The Mirror for a product type */
2931 trait Product extends Mirror {
3032
31- /** The types of the product elements */
32- type MirroredElemTypes <: Tuple
33-
3433 /** The names of the product elements */
3534 type MirroredElemLabels <: Tuple
3635
@@ -40,6 +39,7 @@ object deriving {
4039
4140 trait Singleton extends Product {
4241 type MirroredMonoType = this .type
42+ type MirroredTypeConstructor = this .type
4343 type MirroredElemTypes = Unit
4444 type MirroredElemLabels = Unit
4545 def fromProduct (p : scala.Product ) = this
@@ -48,14 +48,15 @@ object deriving {
4848 /** A proxy for Scala 2 singletons, which do not inherit `Singleton` directly */
4949 class SingletonProxy (val value : AnyRef ) extends Product {
5050 type MirroredMonoType = value.type
51+ type MirroredTypeConstructor = value.type
5152 type MirroredElemTypes = Unit
5253 type MirroredElemLabels = Unit
5354 def fromProduct (p : scala.Product ) = value
5455 }
5556
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 }
5960 }
6061
6162 /** Helper class to turn arrays into products */
0 commit comments