aboutsummaryrefslogtreecommitdiff
path: root/examples/src/main/scala/show.scala
diff options
context:
space:
mode:
Diffstat (limited to 'examples/src/main/scala/show.scala')
-rw-r--r--examples/src/main/scala/show.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/src/main/scala/show.scala b/examples/src/main/scala/show.scala
index e101c11..fdebb78 100644
--- a/examples/src/main/scala/show.scala
+++ b/examples/src/main/scala/show.scala
@@ -21,7 +21,10 @@ trait GenericShow[Out] {
/** creates a new [[Show]] instance by labelling and joining (with `mkString`) the result of
* showing each parameter, and prefixing it with the class name */
def combine[T](ctx: CaseClass[Typeclass, T]): Show[Out, T] = new Show[Out, T] {
- def show(value: T) = {
+ def show(value: T) = if(ctx.isValueClass) {
+ val param = ctx.parameters.head
+ param.typeclass.show(param.dereference(value))
+ } else {
val paramStrings = ctx.parameters.map { param =>
s"${param.label}=${param.typeclass.show(param.dereference(value))}"
}