Cats Api Documentation

Version: 1.2.0

cats.applicative.validation

The Validation applicative implementation and helper functions for validating values. Isomorphic to Either.

branch

(branch v fail-f ok-f)

Given a validation value and two functions, if the validation is a failure apply the first function to the value it contains; if the validation is a success apply the second function to its value.

branch-fail

(branch-fail v fail-f)

Given a validation value and a function, if the validation is a failure, apply the function to the value it contains; if the validation is a success, return it.

branch-ok

(branch-ok v ok-f)

Given a validation value and a function, if the validation is a success, apply the function to the value it contains; if the validation is a failure, return it.

either->validation

(either->validation ae)

fail

(fail)(fail v)

A Fail type constructor.

fail?

(fail? v)

Return true if v is an instance of Fail type.

ok

(ok v)

An Ok type constructor.

ok?

(ok? v)

Return true if v is an instance of Ok type.

validation->either

(validation->either av)

validation?

(validation? v)

Return true in case of v is instance of the Validation applicative.