object Test extends App {
def print(s: String)(implicit p: Prefixer) = {
println(p.prefix + s)
}
print("test")
}
case class Prefixer(prefix: String)
object Prefixer {
implicit val p = Prefixer("***")
}
The above code does not compile, because the compiler is not able to find an implicit value for Prefixer. However, if I put the case class Prefixer and the companion object in another file it works. Why is that?