in src/main/scala/com/gu/ssm/utils/attempt/Attempt.scala [18:30]
def map[B](f: A => B)(implicit ec: ExecutionContext): Attempt[B] =
flatMap(a => Attempt.Right(f(a)))
/**
* Create an Attempt by combining this with the result of a dependant operation
* that returns a new Attempt.
*/
def flatMap[B](f: A => Attempt[B])(implicit ec: ExecutionContext): Attempt[B] = Attempt {
asFuture.flatMap {
case Right(a) => f(a).asFuture
case Left(e) => Future.successful(Left(e))
}
}