Skip to content

Add Validated control type #826

@johnmcclean

Description

@johnmcclean

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions