hjsonschema-0.10.0.2: JSON Schema library

Safe HaskellNone
LanguageHaskell2010

Data.Validator.Failure

Synopsis

Documentation

data Failure err Source

Validators shouldn't know more about the schema they're going to be used with than necessary. If a validator throws errors using the error sum type of a particular schema, then it can't be used with other schemas later that have different error sum types (at least not without writing partial functions).

Thus validators that can only fail in one way return FailureInfos. Validators that can fail in multiple ways return ValidationFailures along with an custom error sum type for that particular validator.

It's the job of a schema's validate function to unify the errors produced by the validators it uses into a single error sum type for that schema. The schema's validate function will return a ValidationFailure with that sum type as its type argument.

Instances

Eq err => Eq (Failure err) Source 
Show err => Show (Failure err) Source 

modFailure :: (a -> b) -> Failure a -> Failure b Source