-- 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, based on
-- the work described in:
--
--
@package formlets
@version 0.7.2
module Text.Formlets
-- | Helper function for genereting input components based forms.
--
-- see also optionalInput, generalInput, and
-- generalInputMulti
input' :: (Monad m) => (String -> String -> xml) -> Maybe String -> Form xml m String
-- | deprecated. See input'
inputM' :: (Monad m) => (String -> String -> xml) -> Maybe String -> Form xml m String
-- | Create a form control which is not required to be successful
--
-- There is no way to provide a default value, because that would result
-- in the control being successful.
--
-- For more information on successful controls see:
--
--
-- http://www.w3.org/TR/html401/interact/forms.html#successful-controls
--
-- see also input', generalInput, and
-- generalInputMulti
optionalInput :: (Monad m) => (String -> xml) -> Form xml m (Maybe String)
-- | generate a form control
--
-- see also input', optionalInput,
-- generalInputMulti.
generalInput :: (Monad m) => (String -> Maybe String -> xml) -> Form xml m (Maybe String)
-- | generate a form control which can return multiple values
--
-- Useful for controls such as checkboxes and multiple select .
--
-- see also input', optionalInput, generalInput.
generalInputMulti :: (Monad m) => (String -> [String] -> xml) -> 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 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), 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 :: (xml -> xml1) -> Form xml m a -> Form xml1 m a
-- | Combine the XML components of two forms using f, and combine the
-- values using g.
plug2 :: (Monad m) => (xml -> xml1 -> xml2) -> (a -> b -> Failing c) -> Form xml m a -> Form xml1 m b -> Form xml2 m c
plug' :: (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
data Rect
Rect :: Int -> Int -> Rect
rectCols :: Rect -> Int
rectRows :: Rect -> Int
-- | Choose a good number of rows for a textarea input. Uses the number of
-- newlines in the string and the number of lines that are too long for
-- the desired width.
stringRect :: Int -> String -> Rect
instance Typeable Rect
instance Typeable ContentType
instance Typeable File
instance Eq Rect
instance Ord Rect
instance Show Rect
instance Read Rect
instance Data Rect
instance Eq ContentType
instance Show ContentType
instance Read ContentType
instance Data ContentType
instance Eq File
instance Show File
instance Read File
instance Data 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]
module Text.XHtml.Transitional.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