digestive-functors-0.0.1: A general way to consume input using applicative functors

Text.Digestive.Validate

Description

Validators that can be attached to forms

Synopsis

Documentation

data Validator m e a Source

A validator. Invariant: the validator should not modify the result value, only check it.

Instances

Monad m => Monoid (Validator m e a) 

validate :: Monad m => Form m i e v a -> Validator m e a -> Form m i e v aSource

Attach a validator to a form.

validateMany :: Monad m => Form m i e v a -> [Validator m e a] -> Form m i e v aSource

Attach multiple validators to a form.

checkSource

Arguments

:: Monad m 
=> e

Error message

-> (a -> Bool)

Actual validation

-> Validator m e a

Resulting validator

Easy way to create a pure validator

checkMSource

Arguments

:: Monad m 
=> e

Error message

-> (a -> m Bool)

Actual validation

-> Validator m e a

Resulting validator

Easy way to create a monadic validator