Hoogle Search
Within LTS Haskell 24.38 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
This module provides a tool for validation of forms in the JSON format. Sending forms in the JSON format via an AJAX request instead of traditional submitting of forms has a number of advantages:
- Smoother user experience: no need to reload the whole page.
- Form rendering is separated and lives only in GET handler, POST (or whatever method you deem appropriate for your use case) handler only handles validation and effects that form submission should initiate.
- You get a chance to organize form input the way you want.
- Define a form parser using type-safe applicative notation with field labels stored on the type label which guards against typos and will force all your field labels be always up to date.
- Parse JSON Value according to the definition of form you created.
- Stop parsing immediately if a form is malformed and cannot be processed.
- Validate forms using any number of composable checkers that you write for your specific problem domain. Once you have a vocabulary of checkers, creation of new forms is just a matter of combining them.
- Collect validation errors from multiple branches of parsing (one branch per form field) in parallel, so that validation errors in one branch do not prevent us from collecting validation errors from other branches. This allows for better user experience as the user can see all validation errors at the same time.
- Use optional and (<|>) from Control.Applicative in your form definitions instead of ad-hoc helpers.
- Perform validation using several form fields at once. You choose which “sub-region” of your form a given check will have access to, see withCheck.
data
FormParser (names :: [Symbol]) e (m :: Type -> Type) aforma Web.Forma The type represents the parser that you can run on a Value with help of runForm. The only way for the user of the library to create a parser is via the field function and its friends, see below. Users can combine existing parsers using applicative notation. FormParser is parametrized by four type variables:
- names—collection of field names we can use in a form to be parsed with this parser.
- e—type of validation errors.
- m—underlying monad, FormParser is not a monad itself, so it's not a monad transformer, but validation can make use of the m monad.
- a—result of parsing.
data
FormResult (names :: [Symbol]) e aforma Web.Forma Result of parsing. names is the collection of allowed field names, e is the type of validation errors, and a is the type of parsing result.
data
ForAll (x :: k) (p :: k1)gdp Logic.Propositional Universal quantification.
-
gi-cairo-render GI.Cairo.Render No documentation available.
-
gi-cairo-render GI.Cairo.Render No documentation available.
-
gi-cairo-render GI.Cairo.Render No documentation available.
-
gi-cairo-render GI.Cairo.Render No documentation available.
-
gi-cairo-render GI.Cairo.Render No documentation available.
pattern
FORM_MIME_TYPE_MULTIPART :: Textgi-soup3 GI.Soup.Constants A macro containing the value multipart/form-data; the MIME type used for posting form data that contains files to be uploaded.