-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Formlets implemented in Haskell -- -- A modular way to build forms based on applicative functors, as -- described in: -- -- @package formlets @version 0.6 module Text.Formlets -- | Helper function for genereting input components based forms. input' :: (Monad m) => (String -> String -> xml) -> Maybe String -> Form xml m String inputM' :: (Monad m) => (String -> String -> m xml) -> Maybe String -> Form xml m String optionalInput :: (Monad m) => (String -> xml) -> Form xml m (Maybe String) -- | A File input widget. inputFile :: (Monad m) => (String -> xml) -> Form xml m File fmapFst :: (t -> t2) -> (t, t1) -> (t2, t1) -- | Returns Nothing if the result is the empty String. nothingIfNull :: (Monad m, Functor m) => Form xml m String -> Form xml m (Maybe String) -- | Check a condition or convert a result check :: (Monad m) => Form xml m a -> (a -> Failing b) -> Form xml m b -- | Apply a predicate to a value and return FR.Success or FR.Failure as -- appropriate ensure :: (Show a) => (a -> Bool) -> String -> a -> Failing a -- | Apply multiple predicates to a value, return FR.Success or all the -- FR.Failure messages ensures :: (Show a) => [(a -> Bool, String)] -> a -> Failing a ensureM :: (Monad m, Show a) => (a -> m Bool) -> String -> a -> m (Failing a) -- | Monadically check a condition or convert a result checkM :: (Monad m) => Form xml m a -> (a -> m (Failing b)) -> Form xml m b pureM :: (Monad m, Monoid xml) => m a -> Form xml m a -- | Runs the form state runFormState :: (Monad m) => Env -> Form xml m a -> (m (Failing a), m xml, FormContentType) -- | This generates a single (or more) forms for a, and a parser function -- for a list of a's. massInput :: (Applicative m, Monad m, Monoid xml) => (Formlet xml m a) -> Formlet xml m [a] -- | Pure xml xml :: (Monad m) => xml -> Form xml m () -- | Transform the XML component plug :: (Monad m, Monoid xml) => (xml -> xml1) -> Form xml m a -> Form xml1 m a plug' :: (Monad m, Monoid xml1) => (xml1 -> xml2) -> Formlet xml1 m a -> Formlet xml2 m a type Env = [(String, Either String File)] data Form xml m a type Formlet xml m a = Maybe a -> Form xml m a data File File :: ByteString -> String -> ContentType -> File content :: File -> ByteString fileName :: File -> String contentType :: File -> ContentType data ContentType ContentType :: String -> String -> [(String, String)] -> ContentType ctType :: ContentType -> String ctSubtype :: ContentType -> String ctParameters :: ContentType -> [(String, String)] data FormContentType UrlEncoded :: FormContentType MultiPart :: FormContentType instance Eq ContentType instance Show ContentType instance Read ContentType instance Eq File instance Show File instance Read File instance Eq FormContentType instance Show FormContentType instance Read FormContentType instance (Monad m, Applicative m, Monoid xml) => Applicative (Form xml m) instance (Functor m, Monad m) => Functor (Form xml m) module Text.XHtml.Strict.Formlets -- | An input field with an optional value input :: (Monad m) => XHtmlFormlet m String -- | A textarea with optional rows and columns, and an optional value textarea :: (Monad m) => Maybe Int -> Maybe Int -> XHtmlFormlet m String -- | A password field with an optional value password :: (Monad m) => XHtmlFormlet m String -- | A file upload form file :: (Monad m) => XHtmlForm m File -- | A checkbox with an optional default value checkbox :: (Monad m) => XHtmlFormlet m Bool -- | A hidden input field hidden :: (Monad m) => XHtmlFormlet m String -- | A validated integer component inputInteger :: (Monad m) => XHtmlFormlet m Integer -- | A radio choice radio :: (Monad m) => [(String, String)] -> XHtmlFormlet m String -- | An radio choice for Enums enumRadio :: (Monad m, Enum a) => [(a, String)] -> XHtmlFormlet m a label :: (Monad m, HTML h) => h -> Form Html m () -- | This is a helper function to generate select boxes selectXHtml :: (HTML h) => [HtmlAttr] -> [(String, h)] -> String -> String -> Html -- | A drop-down for selecting values selectRaw :: (Monad m, HTML h) => [HtmlAttr] -> [(String, h)] -> XHtmlFormlet m String -- | A drop-down for anything that is an instance of Eq select :: (Eq a, Monad m, HTML h) => [HtmlAttr] -> [(a, h)] -> XHtmlFormlet m a -- | A drop-down for all the options from |a|. enumSelect :: (Enum a, Bounded a, Show a, Eq a, Monad m) => [HtmlAttr] -> XHtmlFormlet m a type XHtmlForm m a = Form Html m a type XHtmlFormlet m a = Formlet Html m a module Text.Formlets.MassInput massInput :: (Applicative m, Monad m) => (XHtmlFormlet m a) -> (Html -> Html) -> (Html -> Html) -> XHtmlFormlet m [a]