yesod-form-1.7.4: Form handling support for Yesod Web Framework
Safe HaskellSafe-Inferred
LanguageHaskell2010

Yesod.Form.Input

Description

Provides for getting input from either GET or POST params without generating HTML forms. For more information, see: http://www.yesodweb.com/book/forms#forms_kinds_of_forms.

Synopsis

Documentation

newtype FormInput m a Source #

Type for a form which parses a value of type a with the base monad m (usually your Handler). Can compose this using its Applicative instance.

Constructors

FormInput 

Fields

Instances

Instances details
Monad m => Applicative (FormInput m) Source # 
Instance details

Defined in Yesod.Form.Input

Methods

pure :: a -> FormInput m a #

(<*>) :: FormInput m (a -> b) -> FormInput m a -> FormInput m b #

liftA2 :: (a -> b -> c) -> FormInput m a -> FormInput m b -> FormInput m c #

(*>) :: FormInput m a -> FormInput m b -> FormInput m b #

(<*) :: FormInput m a -> FormInput m b -> FormInput m a #

Monad m => Functor (FormInput m) Source # 
Instance details

Defined in Yesod.Form.Input

Methods

fmap :: (a -> b) -> FormInput m a -> FormInput m b #

(<$) :: a -> FormInput m b -> FormInput m a #

runInputGet :: MonadHandler m => FormInput m a -> m a Source #

Run a FormInput on the GET parameters (i.e., query string). If parsing fails, calls invalidArgs.

runInputGetResult :: MonadHandler m => FormInput m a -> m (FormResult a) Source #

Run a FormInput on the GET parameters (i.e., query string). Does not throw exceptions on failure.

Since 1.4.1

runInputPost :: MonadHandler m => FormInput m a -> m a Source #

Run a FormInput on the POST parameters (i.e., request body). If parsing fails, calls invalidArgs.

runInputPostResult :: MonadHandler m => FormInput m a -> m (FormResult a) Source #

Run a FormInput on the POST parameters (i.e., request body). Does not throw exceptions on failure.

ireq Source #

Arguments

:: (Monad m, RenderMessage (HandlerSite m) FormMessage) 
=> Field m a 
-> Text

name of the field

-> FormInput m a 

Promote a Field into a FormInput, requiring that the value be present and valid.

iopt :: Monad m => Field m a -> Text -> FormInput m (Maybe a) Source #

Promote a Field into a FormInput, with its presence being optional. If the value is present but does not parse correctly, the form will still fail.