jcversan (4) [Avatar] Offline
#1
Hi All

I'm already stuck in chapter 6 due I don't grasp how Scala infers the type of the ExecutorService in this function

def fork[A](a: => Par[A]): Par[A] =
es => es.submit(new Callable[A] {
def call = a(es).get
})

Thanks!
runar (53) [Avatar] Offline
#2
Re: Problem with Scala Type Inference
Par[A] is a type alias for ExecutorService => A. So giving the type annotation for the return type as Par[A] tells Scala that the `es` argument should be of type `ExecutorService`.