import { Either , Left , mapLeft , Right } from '@typed/either' ; export type Validation < A , B > = Either < readonly A [ ] , B > ; export namespace Validation { export const of = < A , B > ( value ) : Validation < A , B > => Right . of ( value ) ; export const error = < A , B > ( error ) : Validation < A , B > => Left . of ( [ error ] ) ; export const fromEither = < A , B > ( either ) : Validation < A , B > => mapLeft ( ( a ) => [ a ] , either ) ; }