import * as A from 'fp-ts/Applicative' import * as E from 'fp-ts/Either' import { pipe } from 'fp-ts/function' import * as RA from 'fp-ts/ReadonlyArray' export type Validation = E.Either, A> export const fromEither = (fa: E.Either): Validation => pipe(fa, E.mapLeft(RA.of)) export const getMonoid = () => A.getApplicativeMonoid(E.getApplicativeValidation(RA.getSemigroup()))