Commits

Bryan O'Sullivan committed 9e9bdba

Fix benchmark build with older bytestring

  • Participants
  • Parent commits 6dcc2e0

Comments (0)

Files changed (1)

File benchmarks/CompareWithJSON.hs

 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)
         ]
       ]