 | hvac-0.1: Http view and controller. A transactional, declarative framework for lightweight web applications. | Contents | Index |
|
| Network.Frameworks.HVAC.Validators | | Portability | portable | | Stability | experimental | | Maintainer | s.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 |
|
|
|
| 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 |