|
|
|
|
|
by mrkeen
1204 days ago
|
|
> password validation (the annoying part that asks for capital letter, digit, special character? -- I want to see the author implement a parser to parse possible inputs to password field, while also giving helpful error messages s.a. "you forgot to use a digit"). This is what Applicative Functors were born to do. Here's a good article on it: https://www.baeldung.com/vavr-validation-api Check the types: public Validation<Seq<String>, User> validateUser(...)
Even though it's called "validation", it's still the approach the OP recommends.It reads as "If you have a Seq of Strings, you might be able to construct a User, or get back validation errors instead". Contrast this with the wrong way of doing things: User user = new User(seqOfStrings);
user.validate();
|
|