-- 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.3 module Text.Formlets -- | Helper function for genereting input components based forms. input' :: (String -> String -> xml) -> Maybe String -> Form xml String inputFile :: (String -> xml) -> Form xml File fmapFst :: (t -> t2) -> (t, t1) -> (t2, t1) -- | Add additional validation to an already validated component check :: Form xml a -> (a -> Failing b) -> Form xml b -- | Apply a predicate to a value and return Success or Failure as -- appropriate ensure :: (Show a) => (a -> Bool) -> String -> a -> Failing a -- | Apply multiple predicates to a value, return Success or all the -- Failure messages ensures :: (Show a) => [(a -> Bool, String)] -> a -> Failing a -- | Runs the form state runFormState :: Env -> Form xml a -> (Collector (Failing a), xml, FormContentType) -- | Component: just some xml xml :: xml -> Form xml () -- | Transform the XML component plug :: (Plus xml) => (xml -> xml) -> Form xml a -> Form xml a type Env = [(String, Either String File)] data Form xml a class Plus a zero :: (Plus a) => a plus :: (Plus a) => a -> a -> 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 (Plus xml) => Applicative (Form xml) instance Functor (Form xml) module Text.XHtml.Strict.Formlets -- | An input field with an optional value input :: Maybe String -> XHtmlForm String textarea :: Maybe String -> XHtmlForm String -- | A password field with an optional value password :: Maybe String -> XHtmlForm String file :: XHtmlForm File -- | A hidden input field hidden :: Maybe String -> XHtmlForm String -- | A validated integer component inputInteger :: Maybe Integer -> XHtmlForm Integer -- | A radio choice radio :: [(String, String)] -> Maybe String -> XHtmlForm String enumRadio :: (Enum a) => [(a, String)] -> Maybe a -> XHtmlForm a type XHtmlForm a = Form Html a instance Plus Html