Skip to content

Instantly share code, notes, and snippets.

@longliveenduro
Last active January 1, 2016 05:39
Show Gist options
  • Select an option

  • Save longliveenduro/8099748 to your computer and use it in GitHub Desktop.

Select an option

Save longliveenduro/8099748 to your computer and use it in GitHub Desktop.
Validations: UserService with Either
class UserId(id: Int) extends AnyVal
trait UserRegistrationFailures
case object NicknameAlreadyExists extends UserRegistrationFailures
case object EmailAlreadyExists extends UserRegistrationFailures
trait UserService {
def registerUser(nickname: String, email: String, password: String): Future[\/[NonEmptyList[UserRegistrationFailures], UserId]]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment