I am currently playing with non-blocking Scalaz futures. Promises I'm struggling to make the following tail-recursive function:
@tailrec
private def repeat( res: Promise[I] ):Promise[I] =
res map p flatMap {
(b:Boolean) =>
if( b ) repeat( res flatMap f ) else res
}
where pis a predicate with type I=>Boolean, and fis a parallel function with type I=>Promise[I].
The method compiles without annotation.
Any clues? Thanks
source
share