Commits

Bryan O'Sullivan committed 5b58703

Drop support for older bytestring and text

Comments (0)

Files changed (7)

Data/Aeson/Encode.hs

-{-# LANGUAGE CPP, BangPatterns, OverloadedStrings #-}
+{-# LANGUAGE BangPatterns, OverloadedStrings #-}
 
 -- |
 -- Module:      Data.Aeson.Encode

Data/Aeson/Parser/Internal.hs

-{-# LANGUAGE CPP, BangPatterns, OverloadedStrings #-}
+{-# LANGUAGE BangPatterns, OverloadedStrings #-}
 
 -- |
 -- Module:      Data.Aeson.Parser.Internal
 
 commaSeparated :: Parser a -> Word8 -> Parser [a]
 commaSeparated item endByte = do
-  w <- peekWord8'
+  w <- A.peekWord8'
   if w == endByte
     then A.anyWord8 >> return []
     else loop
 -- to preserve interoperability and security.
 value :: Parser Value
 value = do
-  w <- peekWord8'
+  w <- A.peekWord8'
   case w of
     DOUBLE_QUOTE  -> A.anyWord8 *> (String <$> jstring_)
     OPEN_CURLY    -> A.anyWord8 *> object_
 -- | Strict version of 'value'. See also 'json''.
 value' :: Parser Value
 value' = do
-  w <- peekWord8'
+  w <- A.peekWord8'
   case w of
     DOUBLE_QUOTE  -> do
                      !s <- A.anyWord8 *> jstring_
 toByteString :: Builder -> ByteString
 toByteString = L.toStrict . toLazyByteString
 {-# INLINE toByteString #-}
-
-peekWord8' :: A.Parser Word8
-#if MIN_VERSION_attoparsec(0,11,1)
-peekWord8' = A.peekWord8'
-#else
-peekWord8' = maybe (fail "not enough bytes") return =<< A.peekWord8
-#endif
 import Prelude             ( String, (-), Integer, fromIntegral, error )
 import Text.Printf         ( printf )
 import Text.Show           ( show )
-#if __GLASGOW_HASKELL__ < 700
-import Control.Monad       ( (>>=), (>>) )
-import Prelude             ( fromInteger )
-#endif
 -- from unordered-containers:
 import qualified Data.HashMap.Strict as H ( lookup, toList )
 -- from template-haskell:

Data/Aeson/Types/Internal.hs

-{-# LANGUAGE CPP, DeriveDataTypeable, GeneralizedNewtypeDeriving, Rank2Types #-}
+{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving, Rank2Types #-}
 
 -- |
 -- Module:      Data.Aeson.Types.Internal
 name:            aeson
-version:         0.7.0.4
+version:         0.7.1.0
 license:         BSD3
 license-file:    LICENSE
 category:        Text, Web, JSON
   default: False
   manual: True
 
-flag blaze-builder
-  description: Use blaze-builder instead of bytestring >= 0.10
-  default: False
-
-flag new-bytestring-builder
-  description: Use the new bytestring builder available in bytestring >= 0.10.4.0
-  default: False
-
 library
   exposed-modules:
     Data.Aeson

benchmarks/AesonEncode.hs

-{-# LANGUAGE BangPatterns, CPP, OverloadedStrings #-}
+{-# LANGUAGE BangPatterns, OverloadedStrings #-}
 
 import Control.Exception
 import Control.Monad
 import qualified Data.ByteString as B
 import Control.DeepSeq
 
-#if !MIN_VERSION_bytestring(0,10,0)
-import qualified Data.ByteString.Lazy.Internal as L
-
-instance NFData L.ByteString where
-    rnf = go
-      where go (L.Chunk _ cs) = go cs
-            go L.Empty        = ()
-    {-# INLINE rnf #-}
-#endif
-
 main :: IO ()
 main = do
   args0 <- getArgs

benchmarks/CompareWithJSON.hs

-{-# LANGUAGE CPP #-}
 {-# OPTIONS_GHC -fno-warn-orphans #-}
 
 import Blaze.ByteString.Builder (toLazyByteString)
 import qualified Data.Text.Lazy.Builder  as TLB
 import qualified Data.Text.Lazy.Encoding as TLE
 
-#if !MIN_VERSION_bytestring(0,10,0)
-import qualified Data.ByteString.Lazy.Internal as BL
-
-instance NFData BL.ByteString where
-  rnf (BL.Chunk _ bs) = rnf bs
-  rnf BL.Empty        = ()
-#endif
-
 instance (NFData v) => NFData (J.JSObject v) where
   rnf o = rnf (J.fromJSObject o)
 
 encodeJ :: J.JSValue -> BL.ByteString
 encodeJ = toLazyByteString . fromString . J.encode
 
-#if MIN_VERSION_bytestring(0,10,4)
 encodeToText :: A.Value -> TL.Text
 encodeToText = TLB.toLazyText . A.encodeToTextBuilder . A.toJSON
 
 encodeViaText :: A.Value -> BL.ByteString
 encodeViaText = TLE.encodeUtf8 . encodeToText
-#endif
 
 main :: IO ()
 main = do
     , bgroup "encode" [
         bgroup "en" [
           bench "aeson-to-bytestring" $ nf A.encode (decodeA enA)
-#if MIN_VERSION_bytestring(0,10,4)
         , bench "aeson-via-text-to-bytestring" $ nf encodeViaText (decodeA enA)
         , bench "aeson-to-text" $ nf encodeToText (decodeA enA)
-#endif
         , bench "json"  $ nf encodeJ (decodeJ enJ)
         ]
       , bgroup "jp" [
           bench "aeson-to-bytestring" $ nf A.encode (decodeA jpA)
-#if MIN_VERSION_bytestring(0,10,4)
         , bench "aeson-via-text-to-bytestring" $ nf encodeViaText (decodeA jpA)
         , bench "aeson-to-text" $ nf encodeToText (decodeA jpA)
-#endif
         , bench "json"  $ nf encodeJ (decodeJ jpJ)
         ]
       ]