Future that cannot fail in Scala

Viewed 396

Is there the concept of a Future that cannot fail in Scala?

I'm transforming a Future[Result], which may fail—therefore I handle both a Failure and a Success—into a Future[Option[String]], carrying an optional error message derived from the failure or success states. So far, so good.

Thing is now, I would like to formally (i.e., with the help of the type system) remember that this future will always hold a Success and that I won't need to handle the failure case in the future.

Is there a smart way to do this?

2 Answers
Related