yesod-form 1.3.4.4 → 1.3.5
raw patch · 2 files changed
+18/−6 lines, 2 files
Files
- Yesod/Form/Input.hs +17/−5
- yesod-form.cabal +1/−1
Yesod/Form/Input.hs view
@@ -4,6 +4,7 @@ ( FormInput (..) , runInputGet , runInputPost+ , runInputPostResult , ireq , iopt ) where@@ -66,11 +67,22 @@ toMap = Map.unionsWith (++) . map (\(x, y) -> Map.singleton x [y]) runInputPost :: MonadHandler m => FormInput m a -> m a-runInputPost (FormInput f) = do+runInputPost fi = do+ emx <- runInputPostHelper fi+ case emx of+ Left errs -> invalidArgs errs+ Right x -> return x++runInputPostResult :: MonadHandler m => FormInput m a -> m (FormResult a)+runInputPostResult fi = do+ emx <- runInputPostHelper fi+ case emx of+ Left errs -> return $ FormFailure errs+ Right x -> return $ FormSuccess x++runInputPostHelper :: MonadHandler m => FormInput m a -> m (Either [Text] a)+runInputPostHelper (FormInput f) = do (env, fenv) <- liftM (toMap *** toMap) runRequestBody m <- getYesod l <- languages- emx <- f m l env fenv- case emx of- Left errs -> invalidArgs $ errs []- Right x -> return x+ fmap (either (Left . ($ [])) Right) $ f m l env fenv
yesod-form.cabal view
@@ -1,5 +1,5 @@ name: yesod-form-version: 1.3.4.4+version: 1.3.5 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>