This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package models.error | |
import org.scalactic._ | |
import scala.concurrent.{ExecutionContext, Future} | |
import org.scalactic.Accumulation._ | |
trait Error | |
object FutureOr { | |
type Errors = Every[Error] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.Try | |
// isn't the following line supposed not to compile ? | |
val foo: Try[Unit] = Try{1+1}.map{x => Try{x/0}} | |
// foo: scala.util.Try[Unit] = Success(()) | |
val foo: Try[Unit] = Try{1+1}.flatMap{x => Try{x/0}} | |
// scala.util.Try[Unit] = Failure(java.lang.ArithmeticException: / by zero) |