jcversan (4) [Avatar] Offline
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

runar (53) [Avatar] Offline
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`.