packages feed

digestive-functors 0.2.0.1 → 0.2.1.0

raw patch · 2 files changed

+15/−1 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Text.Digestive.Types: runViewForm :: Monad m => Form m i e v a -> String -> Environment m i -> m (v, Maybe a)
- Text.Digestive.Forms: class FormInput i f | i -> f
+ Text.Digestive.Forms: class FormInput i f | i -> f where getInputString = listToMaybe . getInputStrings getInputText = listToMaybe . getInputTexts getInputTexts = map pack . getInputStrings

Files

digestive-functors.cabal view
@@ -1,5 +1,5 @@ Name:     digestive-functors-Version:  0.2.0.1+Version:  0.2.1.0 Synopsis: A general way to consume input using applicative functors  Description:         Digestive functors is a library to generate and process
src/Text/Digestive/Types.hs view
@@ -20,6 +20,7 @@     , (<++)     , mapView     , runForm+    , runViewForm     , eitherForm     , viewForm     ) where@@ -205,6 +206,19 @@     return $ case result of         Error e  -> Left $ unView view' e         Ok x     -> Right x++-- | Evaluate a form, return view and a result if successful+runViewForm :: Monad m+            => Form m i e v a+            -> String+            -> Environment m i+            -> m (v, Maybe a)+runViewForm form id' env = do+    (view', mresult) <- runForm form id' env+    result <- mresult+    return $ case result of+        Error e -> (unView view' e, Nothing)+        Ok x    -> (unView view' [], Just x)  -- | Just evaluate the form to a view. This usually maps to a GET request in the -- browser.