hvac-0.1: Http view and controller. A transactional, declarative framework for lightweight web applications.ContentsIndex
Network.Frameworks.HVAC.Validators
Portabilityportable
Stabilityexperimental
Maintainers.clover@gmail.com
Description
Basic validators. You can write your own -- they're easy! Take a value, then fail with a useful error message or return a value, possibly the same, possibly transformed. That's it. Compose validators with Kleisi composition -- i.e., >=>. Validators may also perform nearly all HVAC operations that do not affect global state. For annoying reasons related to type-inference, they may not, however, access the session.
Synopsis
nonEmpty :: ValidationFunc s String String
lengthAtLeast :: Int -> ValidationFunc s String String
lengthUnder :: Int -> ValidationFunc s String String
trim :: ValidationFunc s String String
onNull :: String -> ValidationFunc s String String
validEmail :: ValidationFunc s String String
readValidated :: Read a => ValidationFunc s String a
Documentation
nonEmpty :: ValidationFunc s String String
Checks that the input is not empty. nonEmpty x = if null x then fail "No input." else return x
lengthAtLeast :: Int -> ValidationFunc s String String
Checks the input for minimum length.
lengthUnder :: Int -> ValidationFunc s String String
Checks the input for maximum length.
trim :: ValidationFunc s String String
Removes leading and trailing whitespace.
onNull :: String -> ValidationFunc s String String
Replaces empty input with a default value.
validEmail :: ValidationFunc s String String
Basic Email Validation Regex.
readValidated :: Read a => ValidationFunc s String a
readM specialized to the validation monad.
Produced by Haddock version 2.0.0.0