Is there a simple way to flatten a collection of try\'s to give either a success of the try values, or just the failure? For example:
def map(l:List[Int]) =
These are my 2cents:
def sequence[A, M[_] <: TraversableOnce[_]](in: M[Try[A]]) (implicit cbf:CanBuildFrom[M[Try[A]], A, M[A]]): Try[M[A]] = { in.foldLeft(Try(cbf(in))) { (txs, tx) => for { xs <- txs x <- tx.asInstanceOf[Try[A]] } yield { xs += x } }.map(_.result()) }