implicitlyScalaの例で使用されているという名前の関数を見てきました。それは何ですか、それはどのように使用されますか?
ここに例:
scala> sealed trait Foo[T] { def apply(list : List[T]) : Unit }; object Foo {
     |                         implicit def stringImpl = new Foo[String] {
     |                             def apply(list : List[String]) = println("String")
     |                         }
     |                         implicit def intImpl = new Foo[Int] {
     |                             def apply(list : List[Int]) =  println("Int")
     |                         }
     |                     } ; def foo[A : Foo](x : List[A]) = implicitly[Foo[A]].apply(x)
defined trait Foo
defined module Foo
foo: [A](x: List[A])(implicit evidence$1: Foo[A])Unit
scala> foo(1)
<console>:8: error: type mismatch;
 found   : Int(1)
 required: List[?]
       foo(1)
           ^
scala> foo(List(1,2,3))
Int
scala> foo(List("a","b","c"))
String
scala> foo(List(1.0))
<console>:8: error: could not find implicit value for evidence parameter of type
 Foo[Double]
       foo(List(1.0))
          ^implicitly[Foo[A]].apply(x)コンパイラーはパラメーターを使用implicitly[Foo[A]](x)して呼び出すことを意味していると考えているため、   作成する必要があることに注意しimplicitlyてください。
オブジェクト/タイプ/その他を調査する方法も参照してください。Scala REPLから?そして、Scalaは暗黙的にどこを探しますか?