Text.Formlets
- input' :: Monad m => (String -> String -> xml) -> Maybe String -> Form xml m String
- inputFile :: Monad m => (String -> xml) -> Form xml m File
- fmapFst :: (t -> t2) -> (t, t1) -> (t2, t1)
- check :: Monad m => Form xml m a -> (a -> Failing b) -> Form xml m b
- ensure :: Show a => (a -> Bool) -> String -> a -> Failing a
- ensures :: Show a => [(a -> Bool, String)] -> a -> Failing a
- ensureM :: (Monad m, Show a) => (a -> m Bool) -> String -> a -> m (Failing a)
- checkM :: Monad m => Form xml m a -> (a -> m (Failing b)) -> Form xml m b
- runFormState :: Monad m => Env -> Form xml m a -> (Collector (m (Failing a)), xml, FormContentType)
- xml :: Monad m => xml -> Form xml m ()
- plug :: Plus xml => (xml -> xml) -> Form xml m a -> Form xml m a
- type Env = [(String, Either String File)]
- data Form xml m a
- class Plus a where
- data File = File {}
- data ContentType = ContentType {}
- data FormContentType
- = UrlEncoded
- | MultiPart
Documentation
input' :: Monad m => (String -> String -> xml) -> Maybe String -> Form xml m StringSource
Helper function for genereting input components based forms.
check :: Monad m => Form xml m a -> (a -> Failing b) -> Form xml m bSource
Add additional validation to an already validated component
Arguments
| :: Show a | |
| => (a -> Bool) | The predicate |
| -> String | The error message, in case the predicate fails |
| -> a | The value |
| -> Failing a |
Apply a predicate to a value and return Success or Failure as appropriate
Arguments
| :: Show a | |
| => [(a -> Bool, String)] | List of predicate functions and error messages, in case the predicate fails |
| -> a | The value |
| -> Failing a |
Apply multiple predicates to a value, return Success or all the Failure messages
checkM :: Monad m => Form xml m a -> (a -> m (Failing b)) -> Form xml m bSource
Add additional validation to an already validated component
Arguments
| :: Monad m | |
| => Env | A previously filled environment (may be empty) |
| -> Form xml m a | The form |
| -> (Collector (m (Failing a)), xml, FormContentType) |
Runs the form state
Instances
| (Functor m, Monad m) => Functor (Form xml m) | |
| (Monad m, Applicative m, Plus xml) => Applicative (Form xml m) |
Constructors
| File | |
Fields
| |