validator/common
Types
Errors
Error type returned by the validator.
This is a tuple with the first error and a list of all errors. The list includes the first error.
pub type Errors(error) = tuple(error, List(error))
Validator
A Validator is a function that takes an input and returns a ValidatorResult
pub type Validator(input, output, error) = fn(input) -> ValidatorResult(output, error)
ValidatorResult
pub type ValidatorResult(output, error) = Result(output, Errors(error))
Functions
custom
pub fn custom( error: a, check: fn(b) -> Option(c), ) -> fn(b) -> Result(c, tuple(a, List(a)))
Create a custom validator, see documentation in root module