Say I define the following:
type Func1 = PartialFunction[Int, String]
case class A(f: Int => String)
implicit def toA(func: Func1): A = A(func(_))
Then I might want to use the implicit conversion thus:
val a: A = {
case i: Int => i.toString
}
But this does now compile. However explicit use of the function is fine:
val a: A = toA({
case i: Int => i.toString
})
Why is this?
doesn't compile either:
According to Scaladocs, working code is
If you want implicit conversion try