packages feed

yesod-form 1.4.14 → 1.4.15

raw patch · 3 files changed

+18/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Yesod.Form.Types: instance GHC.Base.Alternative Yesod.Form.Types.FormResult

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.4.15++* Added `Alternative` instance to `FormResult` to simplify handling pages with multiple forms.+ ## 1.4.14  * Added `WForm` to reduce the verbosity using monadic forms.
Yesod/Form/Types.hs view
@@ -30,7 +30,7 @@ #define Html Markup #define ToHtml ToMarkup #define toHtml toMarkup-import Control.Applicative ((<$>), Applicative (..))+import Control.Applicative ((<$>), Alternative (..), Applicative (..)) import Control.Monad (liftM) import Control.Monad.Trans.Class import Data.String (IsString (..))@@ -45,6 +45,8 @@ -- -- The 'Applicative' instance will concatenate the failure messages in two -- 'FormResult's.+-- The 'Alternative' instance will choose 'FormFailure' before 'FormSuccess',+-- and 'FormMissing' last of all. data FormResult a = FormMissing                   | FormFailure [Text]                   | FormSuccess a@@ -79,6 +81,16 @@       FormSuccess a -> fmap FormSuccess (f a)       FormFailure errs -> pure (FormFailure errs)       FormMissing -> pure FormMissing++-- | @since 1.4.15+instance Alternative FormResult where+    empty = FormMissing++    FormFailure e    <|> _             = FormFailure e+    _                <|> FormFailure e = FormFailure e+    FormSuccess s    <|> FormSuccess _ = FormSuccess s+    FormMissing      <|> result        = result+    result           <|> FormMissing   = result  -- | The encoding type required by a form. The 'ToHtml' instance produces values -- that can be inserted directly into HTML.
yesod-form.cabal view
@@ -1,5 +1,5 @@ name:            yesod-form-version:         1.4.14+version:         1.4.15 license:         MIT license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>