I am using EitherT[Future, Failure, Option[B]]
in the following function which does foldLeft
. How to set Initial value for foldLeft
in the code below ?
def doWork[A, B](seq: Set[A])(f: A => EitherT[Future, Failure, Option[B]]): EitherT[Future, Failure, Set[Option[B]]] =
seq.foldLeft(????? how to set this initial value here ????) {
case (acc, nxt) => acc.flatMap(bs => f(nxt).map(b => bs :+ b))
}