Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Validated control type #826

Closed
johnmcclean opened this issue Apr 16, 2018 · 1 comment
Closed

Add Validated control type #826

johnmcclean opened this issue Apr 16, 2018 · 1 comment
Milestone

Comments

@johnmcclean
Copy link
Member

Can be implemented in terms of an Either with a NonEmptyList on the left side.

The accumulate methods on Either aren't sufficient to accumulate validation errors. Validated should have a zip / ap method but flatMap should be renamed due to behavioral conflict with ap / zip (Cats uses andThen).

class Validated<E,T>{
   
   Either<NonEmptyList<E>,T> validated;
   
   <R> R fold(Function<? super T, ? extends R> valid, Function<? super NonEmptyList<E>,? extends R> invalid);
 
   public Validated<E,T> ap(Function<? super T, ? extends Validated<E,R>> fn);
}
@johnmcclean johnmcclean added this to the 10.0.0-M8 milestone Apr 16, 2018
@johnmcclean
Copy link
Member Author

Merged to . master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant