@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE BangPatterns #-}
23{-# LANGUAGE MagicHash #-}
34{-# LANGUAGE NoImplicitPrelude #-}
@@ -21,7 +22,10 @@ import Data.Text (Text)
2122import Typed.Common (load)
2223import qualified Data.Aeson as Aeson
2324import qualified Data.BufferBuilder.Json as Json
25+
26+#ifdef MIN_VERSION_json_builder
2427import qualified Data.Json.Builder as JB
28+#endif
2529
2630data EyeColor = Green | Blue | Brown
2731 deriving (Eq, Show)
@@ -268,6 +272,7 @@ instance Json.ToJson User where
268272 <> "greeting"# Json..=# uGreeting
269273 <> "favoriteFruit"# Json..=# uFavouriteFruit
270274
275+#ifdef MIN_VERSION_json_builder
271276---- json-builder instances ----
272277
273278instance JB.Value EyeColor where
@@ -319,6 +324,7 @@ instance JB.Value User where
319324 <> t "friends" `JB.row` uFriends
320325 <> t "greeting" `JB.row` uGreeting
321326 <> t "favoriteFruit" `JB.row` uFavouriteFruit
327+#endif
322328
323329benchmarks :: Benchmark
324330benchmarks = env (load "json-data/buffer-builder.json") $
@@ -326,5 +332,7 @@ benchmarks = env (load "json-data/buffer-builder.json") $
326332 bgroup "json-bench" [
327333 bench "aeson" $ nf Aeson.encode parsedUserList
328334 , bench "buffer-builder" $ nf Json.encodeJson parsedUserList
335+#ifdef MIN_VERSION_json_builder
329336 , bench "json-builder" $ nf JB.toJsonLBS parsedUserList
337+#endif
330338 ]