in imageCopier/src/main/scala/com/gu/imageCopier/attempt/Attempt.scala [12:22]
def map[B](f: A => B)(implicit ec: ExecutionContext): Attempt[B] =
flatMap(a => Attempt.Right(f(a)))
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))
}
}