packages feed

scotty-binding-play 1.1 → 1.2

raw patch · 3 files changed

+21/−9 lines, 3 filesdep +scotty-binding-play

Dependencies added: scotty-binding-play

Files

Web/Scotty/Binding/Play.hs view
@@ -89,6 +89,9 @@ instance Bindable Text where     parseParams' = parse +instance Bindable String where+    parseParams' = parse+ instance Bindable a => Bindable (Maybe a) where     parseParams' pre msuf = (Just <$> parseParams' pre msuf)         `catchError` \_ -> return Nothing@@ -100,14 +103,12 @@ parseParamList _      []     = fail "not reached" parseParamList prefix (n:ns) = do     a <- parseParams' (prefix <> br) Nothing-    as <- parseParamList prefix ns `catchError` \_ -> return []+    as <- parseParamList prefix ns     return $ a:as+  `catchError` \_ -> return []   where     toText = LTB.toLazyText . LTB.decimal     br = "[" <> toText n <> "]"--fst3 :: (a, b, c) -> a-fst3 (a, _, _) = a  -- x <- param $ mconcat $ catMaybes [Just pname, Just ".", Just fname, sname] getParamS :: Name -> Name -> VarStrictType -> Q (Name, StmtQ)
scotty-binding-play.cabal view
@@ -1,5 +1,5 @@ name:                scotty-binding-play-version:             1.1+version:             1.2 synopsis:            The Play Framework style data binding in Scotty. description:         The Play Framework style data binding in Scotty. license:             BSD3@@ -27,18 +27,17 @@ test-suite spec   type:                exitcode-stdio-1.0   default-language:    Haskell2010-  hs-source-dirs:      ., test+  hs-source-dirs:      test   main-is:             Spec.hs   default-extensions:  OverloadedStrings   ghc-options:         -Wall -threaded   build-depends:       base ==4.*+                     , scotty-binding-play                      , bytestring                      , http-client                      , hspec                      , HUnit-                     , mtl                      , scotty-                     , template-haskell                      , text                      , transformers 
test/Spec.hs view
@@ -10,7 +10,7 @@ import Network.HTTP.Client (Request) import qualified Network.HTTP.Client as HTTP import Test.Hspec-import Test.HUnit+import Test.HUnit hiding (test) import Web.Scotty  import Web.Scotty.Binding.Play@@ -131,3 +131,15 @@                 ]         it "bind Maybe struct data GET" $ test GET ex7 ac7         it "bind Maybe struct data POST" $ test POST ex7 ac7+        let ex8 = [] :: [Int]+        let ac8 = []+        it "bind null array data GET" $ test GET ex8 ac8+        it "bind null array data POST" $ test POST ex8 ac8+        let ex9 = [1, 2, 3] :: [Int]+        let ac9 =+                [ ("data[0]", "1")+                , ("data[1]", "2")+                , ("data[2]", "3")+                ]+        it "bind array data GET" $ test GET ex9 ac9+        it "bind array data POST" $ test POST ex9 ac9