Validation-0.2.0: A data-type like Either but with an accumulating Applicative

Safe HaskellSafe-Infered

Data.Validation

Description

Data types similar to Data.Either that are explicit about failure and success.

Synopsis

Documentation

data AccValidation err a Source

A value of the type err or a, however, the Applicative instance accumulates values. This is witnessed by the Semigroup context on the instance. Note that there is no @Monad@ such that @ap = (<*>).

  • success (+1) * success 7 == AccSuccess 8
  • failure [f1] * success 7 == AccFailure [f1]
  • success (+1) * failure [f2] == AccFailure [f2]
  • failure [f1] * failure [f2] == AccFailure [f1,f2]

data Validation err a Source

A value of the type err or a and isomorphic to Data.Either.

data ValidationT m err a Source

The transformer version of Validation.

Constructors

ValidationT 

Fields

runValidationT :: m (Validation err a)
 

class Validate v whereSource

Construction for validation values.

Methods

success :: a -> v err aSource

Construct a success validation value.

failure :: err -> v err aSource

Construct a failure validation value.