Created
May 16, 2020 20:14
-
-
Save lu4nm3/e995dc2e64962bbf8bf354a2b5b12d75 to your computer and use it in GitHub Desktop.
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
scala> EmailAddress("[email protected]").map(_.copy(emailAddress = "@example.com")) | |
res0: scala.util.Either[String,Either[String,EmailAddress]] = Right(Left(Invalid email address)) | |
scala> for { | |
| e1 <- EmailAddress("[email protected]") | |
| e2 <- e1.copy(emailAddress = "@example.com") | |
| } yield e2 | |
res1: scala.util.Either[String,EmailAddress] = Left(Invalid email address) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment