| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Text.Reform.Generalized
Description
This module provides helper functions for HTML input elements. These helper functions are not specific to any particular web framework or html library.
Synopsis
- input :: (Monad m, FormError error) => (input -> Either error a) -> (FormId -> a -> view) -> a -> Form m input error view () a
- inputMaybe :: (Monad m, FormError error) => (input -> Either error a) -> (FormId -> a -> view) -> a -> Form m input error view () (Maybe a)
- inputNoData :: Monad m => (FormId -> a -> view) -> a -> Form m input error view () ()
- inputFile :: forall m input error view. (Monad m, FormInput input, FormError error, ErrorInputType error ~ input) => (FormId -> view) -> Form m input error view () (FileType input)
- inputMulti :: forall m input error view a lbl. (Functor m, FormError error, ErrorInputType error ~ input, FormInput input, Monad m) => [(a, lbl)] -> (FormId -> [(FormId, Int, lbl, Bool)] -> view) -> (a -> Bool) -> Form m input error view () [a]
- inputChoice :: forall a m error input lbl view. (Functor m, FormError error, ErrorInputType error ~ input, FormInput input, Monad m) => (a -> Bool) -> [(a, lbl)] -> (FormId -> [(FormId, Int, lbl, Bool)] -> view) -> Form m input error view () a
- inputChoiceForms :: forall a m error input lbl view proof. (Functor m, Monad m, FormError error, ErrorInputType error ~ input, FormInput input) => a -> [(Form m input error view proof a, lbl)] -> (FormId -> [(FormId, Int, FormId, view, lbl, Bool)] -> view) -> Form m input error view proof a
- label :: Monad m => (FormId -> view) -> Form m input error view () ()
- errors :: Monad m => ([error] -> view) -> Form m input error view () ()
- childErrors :: Monad m => ([error] -> view) -> Form m input error view () ()
Documentation
input :: (Monad m, FormError error) => (input -> Either error a) -> (FormId -> a -> view) -> a -> Form m input error view () a Source #
used for constructing elements like <input type="text">, which return a single input value.
inputMaybe :: (Monad m, FormError error) => (input -> Either error a) -> (FormId -> a -> view) -> a -> Form m input error view () (Maybe a) Source #
used for elements like <input type="submit"> which are not always present in the form submission data.
inputNoData :: Monad m => (FormId -> a -> view) -> a -> Form m input error view () () Source #
used for elements like <input type="reset"> which take a value, but are never present in the form data set.
inputFile :: forall m input error view. (Monad m, FormInput input, FormError error, ErrorInputType error ~ input) => (FormId -> view) -> Form m input error view () (FileType input) Source #
used for <input type="file">
Arguments
| :: (Functor m, FormError error, ErrorInputType error ~ input, FormInput input, Monad m) | |
| => [(a, lbl)] | value, label, initially checked |
| -> (FormId -> [(FormId, Int, lbl, Bool)] -> view) | function which generates the view |
| -> (a -> Bool) | isChecked/isSelected initially |
| -> Form m input error view () [a] |
used for groups of checkboxes, <select multiple="multiple"> boxes
Arguments
| :: (Functor m, FormError error, ErrorInputType error ~ input, FormInput input, Monad m) | |
| => (a -> Bool) | is default |
| -> [(a, lbl)] | value, label |
| -> (FormId -> [(FormId, Int, lbl, Bool)] -> view) | function which generates the view |
| -> Form m input error view () a |
radio buttons, single <select> boxes
Arguments
| :: (Functor m, Monad m, FormError error, ErrorInputType error ~ input, FormInput input) | |
| => a | |
| -> [(Form m input error view proof a, lbl)] | value, label |
| -> (FormId -> [(FormId, Int, FormId, view, lbl, Bool)] -> view) | function which generates the view |
| -> Form m input error view proof a |
radio buttons, single <select> boxes
label :: Monad m => (FormId -> view) -> Form m input error view () () Source #
used to create <label> elements