I attempted to implement shapeless's SizeOf:package netimport shapeless.{::, HList, HNil}trait SizeOf[A] {  def value: Int}object SizeOf {  def apply[A](implicit ev: SizeOf[A]): SizeOf[A] = ev  implicit def hlistSizeOf[H, L <: HList](implicit ev: SizeOf[L]) =    new SizeOf[H :: L] {      def value: Int = 1 + ev.value  }  implicit val hnilSizeOf = new SizeOf[HNil] {    def value: Int = 0  }  implicit def genSizeOf[A, H <: HList](    implicit gen: Generic.Aux[A, H],             sizeOf: SizeOf[H]): SizeOf[A] =    new SizeOf[A] {      def value: Int = sizeOf.value    }}It appears to be working:import net.SizeOfcase class Foo(x: Int, y: Int, z: Boolean)scala> SizeOf[Foo].valueres0: Int = 3case class A() scala> SizeOf[A].valueres2: Int = 0Please critique this implementation.
Implement SizeOf w/ Shapeless
scala