understanding why future result with for comprehension yields Future[Nothing]

Viewed 1517

Trying to understand why the following expression yields Future[Nothing] and not Future[List[Int]]

def foo(): Future[List[Int]] = Future(List(1,2,3,3,3,4,4,4))
def bar(): Future[Nothing] =for {
    fooList <- foo()
    f <- fooList.distinct
} yield f

of course, this is simplified example, and I can return the fooList directly. But I am trying to understand the reason of getting Future[Nothing] and not Future[List[Int]]

2 Answers
Related