Prevent SOE on Stream traverse with Future

As title says.
Yeah, I'm not so keen on degrading performance on `List` to make it work
with `Stream` (even if I confess that anyway that Future abstraction is
half broken).

I hope the overhead is negligable and I was planning to do some benchmark,
but I'll finally won't have time for this today I think...


On Aug 1, 2014 12:08 PM, "Cody Allen" <notifications@github.com> wrote:

> In core/src/main/scala/scalaz/std/Future.scala:
>
> > @@ -32,8 +32,10 @@ private class FutureInstance(implicit ec: ExecutionContext) extends Monad[Future
> >    override def cojoin[A](a: Future[A]): Future[Future[A]] = Future(a)
> >
> >    // override for actual parallel execution
> > -  override def ap[A, B](fa: => Future[A])(fab: => Future[A => B]) =
> > -    fa zip fab map { case (a, fa) => fa(a) }
> > +  override def ap[A, B](fa: => Future[A])(fab: => Future[A => B]) = {
> > +    val fa0 = join(Future(fa))
>
> @tixxit <https://github.com/tixxit> I believe you that this is a fix, but
> I don't understand it :)
>
> Can someone help me out with how this helps prevent stack overflows?
>
> Is it necessary for it to be Future.apply as opposed to Future.successful?
> I ask because Future.apply has the overhead of forking work off to the
> executor.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/scalaz/scalaz/pull/785/files#r15691284>.
>