scotty-form-0.4.1.0: Html form validation using `ditto`
Safe HaskellNone
LanguageHaskell2010

Web.Scotty.Trans.Form

Synopsis

Documentation

data ScottyFormError Source #

the error case of running a ScottyForm

Instances

Instances details
ToHtml ScottyFormError Source # 
Instance details

Defined in Web.Scotty.Trans.Form

Methods

toHtml :: forall (m :: Type -> Type). Monad m => ScottyFormError -> HtmlT m () #

toHtmlRaw :: forall (m :: Type -> Type). Monad m => ScottyFormError -> HtmlT m () #

FormError [Param] ScottyFormError Source # 
Instance details

Defined in Web.Scotty.Trans.Form

encQP :: [(a, Text)] -> Text Source #

type ScottyForm e m a = Form (ActionT e m) [Param] ScottyFormError (HtmlT (ActionT e m) ()) a Source #

a ditto formlet for scotty

ditto Source #

Arguments

:: (Monoid view, Monad m, ScottyError e) 
=> ([(Text, Text)] -> view -> view)

wrap raw form html inside a form tag

-> Text

form name prefix

-> Form (ActionT e m) [Param] err view a

the formlet

-> ActionT e m (Result err a, view) 

dittoSingle Source #

Arguments

:: (Monad m, ScottyError e) 
=> ([(Text, Text)] -> view -> view)

wrap raw form html inside a form tag

-> Text

form name prefix

-> Form (ActionT e m) [Param] err view a

the formlet

-> ActionT e m (Result err a, view) 

a helpful wrapper around runForm

simpleDittoGET Source #

Arguments

:: (Applicative f, Monad m, ScottyError e) 
=> Text

action

-> Form (ActionT e m) [Param] err (HtmlT f ()) b

formlet

-> ActionT e m (Result err b, HtmlT f ()) 

create <form action=action method="GET" enctype="application/xxx-form-urlencoded">

simpleDittoPOST Source #

Arguments

:: (Applicative f, Monad m, ScottyError e) 
=> Text

action

-> Form (ActionT e m) [Param] err (HtmlT f ()) b

formlet

-> ActionT e m (Result err b, HtmlT f ()) 

create <form action=action method="POST" enctype="application/xxx-form-urlencoded">

liftParser' :: (Text -> Either Text a) -> [Param] -> Either ScottyFormError a Source #

lift a function which parses strict Text into a function which parses a [Param]

liftParser :: (Text -> Either Text a) -> [Param] -> Either ScottyFormError a Source #

lift a function which parses lazy Text into a function which parses a [Param] e.g.

parserRead :: Read a => [Param] -> Either ScottyFormError a
parserRead = liftParser readEither

Orphan instances

FormInput [Param] Source # 
Instance details

Associated Types

type FileType [Param] #

(ScottyError e, Monad m) => Environment (ActionT e m) [Param] Source # 
Instance details

Methods

environment :: FormId -> ActionT e m (Value [Param]) #