digestive-functors-snap 0.0.2.0 → 0.0.2.1
raw patch · 2 files changed
+8/−7 lines, 2 filesdep ~snap-corePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: snap-core
API changes (from Hackage documentation)
- Text.Digestive.Forms.Snap: type SnapForm e v a = Form Snap SnapInput e v a
+ Text.Digestive.Forms.Snap: type SnapForm e v a = MonadSnap m => Form m SnapInput e v a
- Text.Digestive.Forms.Snap: eitherSnapForm :: SnapForm e v a -> String -> Snap (Either v a)
+ Text.Digestive.Forms.Snap: eitherSnapForm :: MonadSnap m => SnapForm e v a -> String -> m (Either v a)
- Text.Digestive.Forms.Snap: snapEnvironment :: Environment Snap SnapInput
+ Text.Digestive.Forms.Snap: snapEnvironment :: MonadSnap m => Environment m SnapInput
Files
digestive-functors-snap.cabal view
@@ -1,5 +1,5 @@ Name: digestive-functors-snap-Version: 0.0.2.0+Version: 0.0.2.1 Synopsis: Snap backend for the digestive-functors library Description: This is a snap backend for the digestive-functors library. @@ -18,6 +18,6 @@ Exposed-modules: Text.Digestive.Forms.Snap Build-depends: base >= 4 && < 5, digestive-functors == 0.0.2.*,- snap-core >= 0.2 && < 0.3,+ snap-core >= 0.3, bytestring >= 0.9, utf8-string >= 0.3
src/Text/Digestive/Forms/Snap.hs view
@@ -1,6 +1,6 @@ -- | Module providing a snap backend for the digestive-functors library ---{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}+{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, Rank2Types #-} module Text.Digestive.Forms.Snap ( SnapInput , SnapForm@@ -26,11 +26,11 @@ -- | Simplification of the `Form` type, instantiated to Snap ---type SnapForm e v a = Form Snap SnapInput e v a+type SnapForm e v a = (MonadSnap m) => Form m SnapInput e v a -- | Environment that will fetch input from the parameters parsed by Snap ---snapEnvironment :: Environment Snap SnapInput+snapEnvironment :: (MonadSnap m) => Environment m SnapInput snapEnvironment = Environment $ \id' -> do input' <- getParam (SB.fromString $ show id') return $ SnapInput <$> input'@@ -44,9 +44,10 @@ -- used. When errors occur, you will receive the form as a view, otherwise, -- you will get the actual result ---eitherSnapForm :: SnapForm e v a -- ^ Form+eitherSnapForm :: (MonadSnap m)+ => SnapForm e v a -- ^ Form -> String -- ^ Form name- -> Snap (Either v a) -- ^ Result+ -> m (Either v a) -- ^ Result eitherSnapForm form name = do method' <- rqMethod <$> getRequest case method' of GET -> liftM Left $ viewForm form name