digestive-functors-scotty 0.1.1.0 → 0.2.0.0
raw patch · 2 files changed
+14/−14 lines, 2 filesdep ~basedep ~bytestringdep ~digestive-functors
Dependency ranges changed: base, bytestring, digestive-functors, scotty, text, wai, wai-extra
Files
digestive-functors-scotty.cabal view
@@ -1,5 +1,5 @@ name: digestive-functors-scotty-version: 0.1.1.0+version: 0.2.0.0 synopsis: Scotty backend for the digestive-functors library description: Scotty backend for the digestive-functors library homepage: https://bitbucket.org/wniare/digestive-functors-scotty@@ -17,14 +17,14 @@ exposed-modules: Text.Digestive.Scotty - build-depends: base ==4.5.*- , digestive-functors ==0.6.*- , scotty ==0.5.*- , bytestring ==0.9.*+ build-depends: base ==4.*+ , digestive-functors ==0.7.*+ , scotty ==0.7.*+ , bytestring >=0.9 && <0.11 , http-types ==0.8.*- , text ==0.11.*- , wai ==1.4.*- , wai-extra ==1.3.*+ , text >=0.11 && <1.0+ , wai >=2.0.0 && <2.2+ , wai-extra >=2.0.1 && <2.2 source-repository head Type: git
src/Text/Digestive/Scotty.hs view
@@ -16,7 +16,7 @@ import Text.Digestive.Types import Text.Digestive.View -scottyEnv :: Monad m => Env (Scotty.ActionT m)+scottyEnv :: (Monad m, Scotty.ScottyError e) => Env (Scotty.ActionT e m) scottyEnv path = do inputs <- parse (TextInput . TL.toStrict) Scotty.params files <- parse (FileInput . B.unpack . fileName) Scotty.files@@ -25,12 +25,12 @@ name = TL.fromStrict . fromPath $ path -- | Runs a form with the HTTP input provided by Scotty.-runForm :: Monad m- => T.Text -- ^ Name of the form- -> Form v (Scotty.ActionT m) a -- ^ Form to run- -> (Scotty.ActionT m) (View v, Maybe a) -- ^ Result+runForm :: (Monad m, Scotty.ScottyError e)+ => T.Text -- ^ Name of the form+ -> Form v (Scotty.ActionT e m) a -- ^ Form to run+ -> (Scotty.ActionT e m) (View v, Maybe a) -- ^ Result runForm name form = Scotty.request >>= \rq -> if requestMethod rq == methodGet then getForm name form >>= \v -> return (v, Nothing)- else postForm name form scottyEnv+ else postForm name form $ const (return scottyEnv)