packages feed

digestive-functors 0.3.0.0 → 0.3.0.1

raw patch · 2 files changed

+16/−5 lines, 2 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Text.Digestive.View: absoluteRef :: Text -> View v -> Text

Files

digestive-functors.cabal view
@@ -1,5 +1,5 @@ Name:     digestive-functors-Version:  0.3.0.0+Version:  0.3.0.1 Synopsis: A practical formlet library  Description:
src/Text/Digestive/View.hs view
@@ -13,6 +13,7 @@       -- * Querying a view       -- ** Low-level     , absolutePath+    , absoluteRef        -- ** Form encoding     , viewEncType@@ -33,6 +34,7 @@ import Data.Maybe (fromMaybe)  import Data.Text (Text)+import qualified Data.Text as T  import Text.Digestive.Field import Text.Digestive.Form.Encoding@@ -77,6 +79,11 @@ absolutePath :: Text -> View v -> Path absolutePath ref view@(View name _ _ _ _ _) = name : viewPath ref view +-- | Determine an absolute path and call 'fromPath' on it. Useful if you're+-- writing a view library...+absoluteRef :: Text -> View v -> Text+absoluteRef ref view = fromPath $ absolutePath ref view+ -- | Internal version of 'absolutePath' which does not take the form name into -- account viewPath :: Text -> View v -> Path@@ -98,7 +105,8 @@     eval' :: Field v b -> Text     eval' field = case field of         Text t -> evalField method givenInput (Text t)-        _      -> ""  -- TODO: perhaps throw error?+        f      -> error $ T.unpack ref ++ ": expected (Text _), " +++            "but got: (" ++ show f ++ ")"  fieldInputChoice :: forall v. Text -> View v -> ([v], Int) fieldInputChoice ref view@(View _ _ form input _ method) =@@ -113,7 +121,8 @@             let x   = evalField method givenInput (Choice xs i)                 idx = fromMaybe 0 $ findIndex (== x) (map fst xs)             in (map snd xs, idx)-        _           -> ([], 0)  -- TODO: perhaps throw error?+        f           -> error $ T.unpack ref ++ ": expected (Choice _ _), " +++            "but got: (" ++ show f ++ ")"  fieldInputBool :: forall v. Text -> View v -> Bool fieldInputBool ref view@(View _ _ form input _ method) =@@ -125,7 +134,8 @@     eval' :: Field v b -> Bool     eval' field = case field of         Bool x -> evalField method givenInput (Bool x)-        _      -> False  -- TODO: perhaps throw error?+        f      -> error $ T.unpack ref ++ ": expected (Bool _), " +++            "but got: (" ++ show f ++ ")"  fieldInputFile :: forall v. Text -> View v -> Maybe FilePath fieldInputFile ref view@(View _ _ form input _ method) =@@ -137,7 +147,8 @@     eval' :: Field v b -> Maybe FilePath     eval' field = case field of         File -> evalField method givenInput File-        _    -> Nothing  -- TODO: perhaps throw error?+        f    -> error $ T.unpack ref ++ ": expected (File), " +++            "but got: (" ++ show f ++ ")"  errors :: Text -> View v -> [v] errors ref view = map snd $ filter ((== viewPath ref view) . fst) $