The flatMap method of the Success is implemented like this:
def flatMap[U](f: T => Try[U]): Try[U] =
try f(value)
catch {
case NonFatal(e) =&g
A regular flatMap takes a sequence of sequences, and put all the elements into one big "flat" sequence
It would be fair to replace word sequence to monad here, because this operation doesn't relate only to collection, actually collections are also monads. Think of Try
as collection that can contain either Success
value of Failure