LabelledGeneric, Typeable } import shapeless.record._ import shapeless.ops.hlist.ToTraversable import shapeless.ops.record.Fields def show[A, R <: HList, F <: HList](a: A)(implicit typ: Typeable[A], lgen: LabelledGeneric.Aux[A, R], fields: Fields.Aux[R, F], toList: ToTraversable.Aux[F, List, (Symbol, Any)] ): String = { val rec = lgen.to(a) rec.fields.toList.map { case (k, v) => s"${k.name}: $v" }.mkString(typ.describe + "(", ", ", ")") } show(Point(1, 2, 3)) // res1: String = Point(x: 1, y: 2, z: 3)