Вопрос

I am currently playing with Scalaz non-blocking futures aka. Promises. I am struggling to make the following function tail-recursive:

@tailrec
private def repeat( res: Promise[I] ):Promise[I] =
  res map p flatMap { 
    (b:Boolean) =>
      if( b ) repeat( res flatMap f ) else res
  }

where p is a predicate with type I=>Boolean and f is a concurrent function with type I=>Promise[I].

The method compiles without the annotation.

Any hints ? Thanks

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top