runInputPostResult is the modified method

This commit is contained in:
Elise Huard 2014-01-31 10:42:40 +01:00
parent 12897ae5a0
commit a417b95a98

View File

@ -67,10 +67,20 @@ toMap = Map.unionsWith (++) . map (\(x, y) -> Map.singleton x [y])
runInputPost :: MonadHandler m => FormInput m a -> m (FormResult a)
runInputPost (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
runInputPostResult :: MonadHandler m => FormInput m a -> m (FormResult a)
runInputPostResult (FormInput f) = do
(env, fenv) <- liftM (toMap *** toMap) runRequestBody
m <- getYesod
l <- languages
emx <- f m l env fenv
case emx of
Left errs -> return $ FormFailure (errs [])
Right x -> return (FormSuccess x)
Right x -> return $ FormSuccess x