attoparsec 0.11.3.1 → 0.11.3.2
raw patch · 3 files changed
+35/−6 lines, 3 filesdep ~basedep ~scientificdep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, scientific, text
API changes (from Hackage documentation)
Files
- attoparsec.cabal +2/−2
- benchmarks/Aeson.hs +33/−3
- benchmarks/attoparsec-benchmarks.cabal +0/−1
attoparsec.cabal view
@@ -1,5 +1,5 @@ name: attoparsec-version: 0.11.3.1+version: 0.11.3.2 license: BSD3 license-file: LICENSE category: Text, Parsing@@ -44,7 +44,7 @@ containers, deepseq, text >= 0.11.3.1,- scientific >= 0.2 && < 0.3+ scientific >= 0.3.1 && < 0.4 exposed-modules: Data.Attoparsec Data.Attoparsec.ByteString
benchmarks/Aeson.hs view
@@ -11,17 +11,19 @@ (Builder, byteString, toLazyByteString, charUtf8, word8) import Control.Applicative ((*>), (<$>), (<*), liftA2, pure)+import Control.DeepSeq (NFData(..)) import Control.Monad (forM)-import Data.Aeson.Types (Result(..), Value(..)) import Data.Attoparsec.ByteString.Char8 (Parser, char, endOfInput, scientific, skipSpace, string) import Data.Bits ((.|.), shiftL) import Data.ByteString (ByteString) import Data.Char (chr)+import Data.List (sort) import Data.Monoid (mappend, mempty)+import Data.Scientific (Scientific) import Data.Text (Text) import Data.Text.Encoding (decodeUtf8')-import Data.Vector as Vector (Vector, fromList)+import Data.Vector as Vector (Vector, foldl', fromList) import Data.Word (Word8) import System.Directory (getDirectoryContents) import System.FilePath ((</>), dropExtension)@@ -50,6 +52,34 @@ #define C_n 110 #define C_t 116 +data Result a = Error String+ | Success a+ deriving (Eq, Show)+++-- | A JSON \"object\" (key\/value map).+type Object = H.HashMap Text Value++-- | A JSON \"array\" (sequence).+type Array = Vector Value++-- | A JSON value represented as a Haskell value.+data Value = Object !Object+ | Array !Array+ | String !Text+ | Number !Scientific+ | Bool !Bool+ | Null+ deriving (Eq, Show)++instance NFData Value where+ rnf (Object o) = rnf o+ rnf (Array a) = Vector.foldl' (\x y -> rnf y `seq` x) () a+ rnf (String s) = rnf s+ rnf (Number n) = rnf n+ rnf (Bool b) = rnf b+ rnf Null = ()+ -- | Parse a top-level JSON value. This must be either an object or -- an array, per RFC 4627. --@@ -311,7 +341,7 @@ aeson :: IO Benchmark aeson = do let path = "json-data"- names <- filter (`notElem` [".", ".."]) <$> getDirectoryContents path+ names <- sort . filter (`notElem` [".", ".."]) <$> getDirectoryContents path benches <- forM names $ \name -> do bs <- B.readFile (path </> name) return . bench (dropExtension name) $ nf (A.parseOnly jsonEOF') bs
benchmarks/attoparsec-benchmarks.cabal view
@@ -16,7 +16,6 @@ hs-source-dirs: .. . ghc-options: -O2 -Wall build-depends:- aeson, array, base == 4.*, bytestring >= 0.10.4.0,