Skip to content

Instantly share code, notes, and snippets.

@davidelettieri
Last active April 17, 2021 22:13
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 davidelettieri/05924714163a02cfb7598be9634231c8 to your computer and use it in GitHub Desktop.
Save davidelettieri/05924714163a02cfb7598be9634231c8 to your computer and use it in GitHub Desktop.
Union<Customer,Failure> ValidateEmail(Customer c) {
if(c.Email is null)
return new Failure("Email is not valid");
return c;
}
Union<Customer,Failure> ValidateNameSurname(Customer c) {
if(c.Name is null)
return new Failure("Name is not valid");
if(c.Surname is null)
return new Failure("Surname is not valid");
return c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment