What precisely is a scala evidence parameter

后端 未结 3 1924
独厮守ぢ
独厮守ぢ 2021-02-02 15:41

I\'ve been trying to find an authoritative definition of what is an evidence parameter, to no avail, for solving a case of \"could not find implicit value for evidence parameter

3条回答
  •  时光取名叫无心
    2021-02-02 16:38

    Scala evidence parameters are prepended to implicit parameter list.

    def foo[A: M](implicit b: B): C
    // expands to:
    // def foo[A](implicit evidence$1: M[A], b: B): C
    

    See specifications for more details. https://www.scala-lang.org/files/archive/spec/2.11/07-implicits.html

提交回复
热议问题