Skip to content

Instantly share code, notes, and snippets.

@lu4nm3
Created May 16, 2020 20:14
Show Gist options
  • Save lu4nm3/e995dc2e64962bbf8bf354a2b5b12d75 to your computer and use it in GitHub Desktop.
Save lu4nm3/e995dc2e64962bbf8bf354a2b5b12d75 to your computer and use it in GitHub Desktop.
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