What is the diff between implicit def and implicit val?

Your boxPrintable takes a type parameter A and a value argument of type Printable[A], so it must be a def.

String is one specific type, so stringPrintable takes no parameters at all, it's just a constant, so you can define it to be a val.

Nothing more to it.


def is evaluated on each request.

val is evaluated when the class is created.

In your example you need a def as soon it has parameters, which are not possible with vals.