Skip to content

Instantly share code, notes, and snippets.

@dcampogiani
Last active May 2, 2018 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcampogiani/b1a3213da53deee236b7d058caae5235 to your computer and use it in GitHub Desktop.
Save dcampogiani/b1a3213da53deee236b7d058caae5235 to your computer and use it in GitHub Desktop.
fun validateData(mail: String, phoneNumber: String): Validated<Nel<String>, Data> {
return Validated.applicative<Nel<ValidationError>>(Nel.semigroup()).map(mail.validatedMail(), phoneNumber.validatedPhoneNumber()) {
Data(it.a, it.b)
}.fix()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment