packages feed

buffer-builder-aeson 0.2.0.3 → 0.2.0.4

raw patch · 2 files changed

+13/−106 lines, 2 filesdep ~basedep ~buffer-builderPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, buffer-builder

API changes (from Hackage documentation)

- Data.BufferBuilder.Aeson: instance ToJson Value
+ Data.BufferBuilder.Aeson: instance Data.BufferBuilder.Json.ToJson Data.Aeson.Types.Internal.Value

Files

buffer-builder-aeson.cabal view
@@ -2,68 +2,41 @@ --  documentation, see http://haskell.org/cabal/users-guide/  name:                buffer-builder-aeson-version:             0.2.0.3+version:             0.2.0.4 synopsis:            Serialize Aeson values with Data.BufferBuilder-description:--    A very fast BufferBuilder-based JSON encoder for Aeson.-    .-    The whole library is a a single orphan instance for Aeson.Value.-    .-    > import Data.Aeson (object, (.=), Value (..))-    > import Data.BufferBuilder.Json (encodeJson)-    > import Data.BufferBuilder.Aeson ()-    > import qualified Data.ByteString as BS-    > -    > stuff :: Value-    > stuff = Array-    >     [ object-    >         [ "name" .= ("eggs" :: String)-    >         , "price" .= (3.141592 :: Double)-    >         ]-    >     , object-    >         [ "name" .= ("cheese" :: String)-    >         , "price" .= (0.57721 :: Double)-    >         ]-    >     ]-    > -    > main :: IO ()-    > main = do-    >     BS.putStrLn $ encodeJson stuff-+-- description: license:             MIT license-file:        LICENSE-author:              Andy Friesen, Chad Austin+author:              Andy Friesen maintainer:          andy.friesen@gmail.com--- copyright:           +-- copyright: category:            Data build-type:          Simple--- extra-source-files:  +-- extra-source-files: cabal-version:       >=1.10-extra-source-files:  test/*.hs bench/*.hs  source-repository this   type:     git   location: https://github.com/andyfriesen/buffer-builder-aeson-  tag:      0.2.0.3+  tag:      0.2.0.4  library   exposed-modules:     Data.BufferBuilder.Aeson   hs-source-dirs:      src   ghc-options: -O2 -Wall   -- ghc-options: -ddump-ds -ddump-simpl -ddump-stg -ddump-opt-cmm -ddump-asm -ddump-to-file-  -  -- other-modules:       -  -- other-extensions:    -  build-depends:       base >=4.6 && <4.8++  -- other-modules:+  -- other-extensions:+  build-depends:       base == 4.*                      , aeson                      , integer-gmp-                     , buffer-builder >=0.2.0.3+                     , buffer-builder >=0.2.0.0                      , unordered-containers                      , vector                      , scientific                      , bytestring-  hs-source-dirs:      +  hs-source-dirs:   default-language:    Haskell2010  test-suite tests@@ -98,7 +71,7 @@   hs-source-dirs: bench   default-language: Haskell2010   ghc-options: -O2 -Wall-  ghc-options: -ddump-ds -ddump-simpl -ddump-stg -ddump-opt-cmm -ddump-asm -ddump-to-file+  -- ghc-options: -ddump-ds -ddump-simpl -ddump-stg -ddump-opt-cmm -ddump-asm -ddump-to-file   build-depends: base                , buffer-builder                , buffer-builder-aeson
− test/AesonQuickCheck.hs
@@ -1,66 +0,0 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}--module AesonQuickCheck where--import Data.Aeson-import Test.QuickCheck-import           Data.Text (Text)-import qualified Data.Text as T-import qualified Data.Vector as V-import           Data.HashMap.Strict (HashMap)-import qualified Data.HashMap.Strict as HashMap-import Data.Scientific-import Data.Hashable (Hashable)-import Control.Applicative---newtype ArbObject = ArbObject { unArbObject :: Object }---- bleh hack-instance Arbitrary Text where-    arbitrary = fmap T.pack $ arbitrary-    shrink txt = fmap T.pack $ shrink $ T.unpack txt--arbitraryArray :: (Arbitrary a) => Gen [a]-arbitraryArray = sized $ \s -> do-    (Positive len) <- arbitrary-    vector $ min s (len `mod` 10)--arbitraryObject :: (Hashable k, Eq k, Arbitrary k, Arbitrary v) => Gen (HashMap k v)-arbitraryObject = fmap HashMap.fromList arbitraryArray--shrinkHashMap hashMap = fmap HashMap.fromList (shrink (HashMap.toList hashMap))--instance Arbitrary ArbObject where-    arbitrary = sized $ \s -> let s' = max 1 (s `div` 10) in-        ArbObject <$> resize s' arbitraryObject--instance Arbitrary Value where-    arbitrary = sized $ \s -> let s' = max 1 (s - 1) in seq s' $ resize s' $ oneof-        [ Object . unArbObject <$> arbitrary-        , Array . V.fromList <$> arbitraryArray-        , String <$> arbitrary-        , Number <$> arbitrary-        , Bool   <$> arbitrary-        , return Null-        ]--    shrink e = case e of-        Object x -> Object <$> shrinkHashMap x-        Array x  -> Array <$> shrink x-        String _ -> []-        Number _ -> []-        Bool _   -> []-        Null     -> []--instance Arbitrary Scientific where-    arbitrary = do-        val <- arbitrary :: Gen Int-        return $ scientific (fromIntegral val) 1-    shrink val = do-        val' <- shrink (floor val)-        return $ scientific val' 0--instance Arbitrary a => Arbitrary (V.Vector a) where-    arbitrary = V.fromList <$> arbitrary-    shrink = fmap V.fromList . shrink . V.toList