This example claims that type inference is not possible for the code below:
def foldLeft1[A, B](as: List[A], b0: B, op: (B, A) => B) = ???
def notPossible = foldLeft1(numbers, 0, _ + _)
However, this seems to be inaccurate for Scala 3, here's the example which works fine with Scala 3.0.0+:
val numbers = List(1, 2, 3, 4, 5,6 ,7 ,8, 9, 10)
def foldLeft1[A, B](as: List[A], b0: B, op: (B, A) => B) =
var res = b0
for a <- as do
res = op(res, a)
res
def notPossible = foldLeft1(numbers, 0, _ + _)
println(notPossible) // prints 55
This example claims that type inference is not possible for the code below:
However, this seems to be inaccurate for Scala 3, here's the example which works fine with Scala 3.0.0+: