Explain the `LowPriorityImplicits` pattern used in Scala type-level programming
问题 When looking at the source of some Scala libraries, e.g. shapeless, I often find traits named LowPriorityImplicits . Can you please explain this pattern? What is the problem that is solved, and how does the pattern solve it? 回答1: That pattern allows you to have hierarchy of implicits avoiding ambiguity-related errors by the compiler and providing a way to prioritise them. As an example consider the following: trait MyTypeclass[T] { def foo: String } object MyTypeclass { implicit def