packages feed

aeson-quick 0.1.1.1 → 0.1.1.2

raw patch · 3 files changed

+22/−16 lines, 3 filesdep +ghc-primPVP ok

version bump matches the API change (PVP)

Dependencies added: ghc-prim

API changes (from Hackage documentation)

Files

aeson-quick.cabal view
@@ -1,7 +1,7 @@ Name:              aeson-quick-Version:           0.1.1.1+Version:           0.1.1.2 Build-Type:        Simple-Cabal-Version:     >= 1.10+Cabal-Version:     >= 1.16 License:           BSD3 License-File:      LICENSE Author:            Scott Sadler@@ -12,7 +12,7 @@ Description:       DSL on top of Aeson. This library is /experimental/. Copyright:         (c) 2014-2017 Scott Sadler Stability:         Experimental-Tested-With:       GHC == 7.8.4, GHC == 7.10.2, GHC == 8.0.1+Tested-With:       GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2, GHC == 8.0.1   Library@@ -25,6 +25,8 @@                     , text                  >= 1.2    && <  1.3                     , unordered-containers  >= 0.2.5  && <  0.3                     , vector                >= 0.10   && <  0.12+  if impl(ghc < 7.5)+    Build-Depends:    ghc-prim              >= 0.2   default-language: Haskell2010  test-suite aeson-quick-test@@ -54,6 +56,7 @@                     , criterion             >= 0.1    && <  1.2                     , text                  >= 1.2    && <  1.3   default-language: Haskell2010+  source-repository head   type:     git
test/Benchmark.hs view
@@ -17,13 +17,13 @@ main :: IO () main = defaultMain   -- TODO: Refactor such that "bench" also tests-  [ bench "aqGetSimple"        $ nf getSimple jsonSimple+  [ bench "quickGetSimple"     $ nf quickGetSimple jsonSimple   , bench "aesonGetSimple"     $ nf aesonGetSimple jsonSimple-  , bench "aqGetComplex"       $ nf getComplex jsonComplex+  , bench "quickGetComplex"    $ nf quickGetComplex jsonComplex   , bench "aesonGetComplex"    $ nf aesonGetComplex jsonComplex-  , bench "aqSetSimple"        $ nf setSimple simple+  , bench "quickSetSimple"     $ nf quickSetSimple simple   , bench "aesonSetSimple"     $ nf aesonSetSimple simple-  , bench "aqSetComplex"       $ nf setComplex complex+  , bench "quickSetComplex"    $ nf quickSetComplex complex   , bench "aesonSetComplex"    $ nf aesonSetComplex complex   , bench "parseSimple"        $ nf parseStructure "{a}"   , bench "parseComplex"       $ nf parseStructure "{a,b:[{c,d:[{e,f}]}]}"@@ -35,12 +35,12 @@     check :: (Value -> Maybe a) -> Value -> a     check f = maybe (error "Nothing") id . f -    getSimple, aesonGetSimple :: Value -> Integer-    getSimple = check (.? "{a}")+    quickGetSimple, aesonGetSimple :: Value -> Integer+    quickGetSimple = check (.? "{a}")     aesonGetSimple = check $ parseMaybe $ withObject "" (.: "a")     -    getComplex, aesonGetComplex :: Value -> [(Text,Float,[Text],[Text])]-    getComplex = check (.! "[{id,ppu,batters:{batter:[{id}]},topping:[{id}]}]")+    quickGetComplex, aesonGetComplex :: Value -> [(Text,Float,[Text],[Text])]+    quickGetComplex = check (.! "[{id,ppu,batters:{batter:[{id}]},topping:[{id}]}]")     aesonGetComplex = check $ parseMaybe $ parseJSON >=> mapM (\o ->       (,,,) <$> o .: "id" <*> o .: "ppu" <*> batters o <*> toppings o)       where@@ -49,13 +49,13 @@         toppings = (.:"topping") >=> mapM (withObject "" (.:"id"))          simple = object ["a" .= Number 1]-    setSimple, aesonSetSimple :: Value -> Bool-    setSimple r = r `must` build "{a}" Null (1::Int) +    quickSetSimple, aesonSetSimple :: Value -> Bool+    quickSetSimple r = r `must` build "{a}" Null (1::Int)      aesonSetSimple r = r `must` object ["a" .= (1::Int)]      Just complex = decode "{\"a\":1,\"b\":[{\"a\":1},{\"a\":2},{\"a\":3}]}"-    setComplex, aesonSetComplex :: Value -> Bool-    setComplex r =+    quickSetComplex, aesonSetComplex :: Value -> Bool+    quickSetComplex r =       let vals = ((1,[1,2,3])::(Int,[Int]))        in r `must` build "{a,b:[{a}]}" Null vals     aesonSetComplex r =
test/Test.hs view
@@ -5,7 +5,6 @@  import Data.Aeson.Quick import Data.ByteString.Lazy (ByteString)-import Data.Either  import Lens.Micro @@ -160,3 +159,7 @@            Just v -> v            Nothing -> error $ "Coult not decode JSON: " ++ show s ++isLeft :: Either a b -> Bool+isLeft e = case e of Left _ -> True+                     _      -> False