-- 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.4.7
module Text.Formlets
-- | Helper function for genereting input components based forms.
input' :: (Monad m) => (String -> String -> xml) -> Maybe String -> Form xml m 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 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
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, Plus xml) => m a -> Form xml m a
-- | Runs the form state
runFormState :: (Monad m) => Env -> String -> Form xml m a -> (m (Failing a), m xml, FormContentType)
-- | Takes a hidden-input field, a form of a and produces a list of a. | |
-- The hidden input field contains a prefix, which is the pointer to the
-- next form. | This form has to have the same variable-names as the
-- original form, but prefixed by the prefix. | | Typically, some
-- client-side code is needed to duplicate the original form and generate
-- a unique prefix.
massInput :: (Plus xml, Applicative m, Monad m) => (Form xml m (Maybe String)) -> Form xml m a -> ([String] -> xml) -> Form xml m [a]
-- | Pure xml
xml :: (Monad m) => xml -> Form xml m ()
-- | Transform the XML component
plug :: (Monad m, Plus xml) => (xml -> xml1) -> Form xml m a -> Form xml1 m a
withPrefix :: String -> Form xml m a -> Form xml m a
type Env = [(String, Either String File)]
data Form xml m 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 (Monad m, Applicative m, Plus 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) => Maybe String -> XHtmlForm m String
textarea :: (Monad m) => Maybe String -> XHtmlForm m String
-- | A password field with an optional value
password :: (Monad m) => Maybe String -> XHtmlForm m String
file :: (Monad m) => XHtmlForm m File
-- | A hidden input field
hidden :: (Monad m) => Maybe String -> XHtmlForm m String
-- | A validated integer component
inputInteger :: (Monad m) => Maybe Integer -> XHtmlForm m Integer
-- | A radio choice
radio :: (Monad m) => [(String, String)] -> Maybe String -> XHtmlForm m String
-- | An radio choice for Enums
enumRadio :: (Monad m, Enum a) => [(a, String)] -> Maybe a -> XHtmlForm m a
selectRaw :: (Monad m) => [(String, String)] -> Maybe String -> XHtmlForm m String
-- | A drop-down for anything that is an instance of Eq
select :: (Eq a, Monad m) => [(a, String)] -> Maybe a -> XHtmlForm m a
type XHtmlForm m a = Form Html m a
instance Plus Html