HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleyesod-form-1.7.11Haskell2010

Yesod.Form.Types

Contents
  1. Helpers
  2. Form
  3. Build forms
Synopsis

Helpers

datadata Enctype

The encoding type required by a form. The ToHtml instance produces values that can be inserted directly into HTML.

Instances7Bounded, Enum, Eq, Semigroup, Monoid, ToMarkup, …
datadata FormResult a

A form can produce three different results: there was no data available, the data was invalid, or there was a successful parse.

The Applicative instance will concatenate the failure messages in two FormResults. The Alternative instance will choose FormFailure before FormSuccess, and FormMissing last of all.

Instances9Functor, Applicative, Foldable, Traversable, Alternative, Eq, …
datadata FormMessage
#
Instances3Eq, Read, Show

Form

typetype WForm (m :: Type -> Type) a = MForm (WriterT [FieldView (HandlerSite m)] m) a

MForm variant stacking a WriterT. The following code example using a monadic form MForm:

formToAForm $ do
  (field1F, field1V) <- mreq textField MsgField1 Nothing
  (field2F, field2V) <- mreq (checkWith field1F textField) MsgField2 Nothing
  (field3F, field3V) <- mreq (checkWith field1F textField) MsgField3 Nothing
  return
    ( MyForm <$> field1F <*> field2F <*> field3F
    , [field1V, field2V, field3V]
    )

Could be rewritten as follows using WForm:

wFormToAForm $ do
  field1F <- wreq textField MsgField1 Nothing
  field2F <- wreq (checkWith field1F textField) MsgField2 Nothing
  field3F <- wreq (checkWith field1F textField) MsgField3 Nothing
  return $ MyForm <$> field1F <*> field2F <*> field3F
newtypenewtype AForm (m :: Type -> Type) a
#
Instances6MonadTrans, Monad, Functor, Applicative, Semigroup, Monoid

Build forms