on master help sign in
Merge pull request #670 from phadej/trim-bounds

Trim bounds

commita4db507c518e1314a9558af134cf645fca04d180 authorAdam Bergmark <adam@bergmark.nl> dateTue 2 Oct 2018, 18:52 (8 years ago) parent59bddd783d5bdb
14 files changed+86−120
.travis.yml+15−12 aeson.cabal+35−23 benchmarks/Compare.hs+8−2 benchmarks/Compare/JsonBench.hs+8 benchmarks/aeson-benchmarks.cabal+6−2 stack-bench.yaml+1−3 stack-ffi-unescape.yaml+2−2 stack-lts10.yaml−9 stack-lts12.yaml+10 stack-lts6.yaml−23 stack-lts7.yaml−17 stack-lts8.yaml−14 stack-lts9.yaml−12 stack-nightly.yaml+1−1
.travis.yml+15−12
@@ -19,19 +19,22 @@ before_cache:
1919
2020matrix:
2121 include:
22− - env: BUILD=hlint CABALVER=2.0 GHCVER=8.2.2
23− compiler: ": #GHC 8.2.2"
24− addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}
25− - env: BUILD=stack CABALVER=2.0 GHCVER=8.2.2 STACK_YAML=stack-bench.yaml
26− compiler: ": #GHC 8.2.2"
27− addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}
28− - env: BUILD=stack CABALVER=2.0 GHCVER=8.2.2 STACK_YAML=stack-ffi-unescape.yaml
29− compiler: ": #GHC 8.2.2"
30− addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}
22+ - env: BUILD=hlint CABALVER=2.2 GHCVER=8.4.3
23+ compiler: ": #GHC 8.4.3"
24+ addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}
25+ - env: BUILD=stack CABALVER=2.2 GHCVER=8.4.3 STACK_YAML=stack-bench.yaml
26+ compiler: ": #GHC 8.4.3"
27+ addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}
28+ - env: BUILD=stack CABALVER=2.2 GHCVER=8.4.3 STACK_YAML=stack-ffi-unescape.yaml
29+ compiler: ": #GHC 8.4.3"
30+ addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}
3131
32− - env: BUILD=cabal CABALVER=2.2 GHCVER=8.4.2
33− compiler: ": #GHC 8.4.2"
34− addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.2], sources: [hvr-ghc]}}
32+ - env: BUILD=cabal CABALVER=2.4 GHCVER=8.6.1
33+ compiler: ": #GHC 8.6.1"
34+ addons: {apt: {packages: [cabal-install-2.4,ghc-8.6.1], sources: [hvr-ghc]}}
35+ - env: BUILD=cabal CABALVER=2.2 GHCVER=8.4.3
36+ compiler: ": #GHC 8.4.3"
37+ addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}
3538 - env: BUILD=cabal CABALVER=2.0 GHCVER=8.2.2
3639 compiler: ": #GHC 8.2.2"
3740 addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}
aeson.cabal+35−23
@@ -99,26 +99,19 @@ library
9999 Data.Attoparsec.Time
100100 Data.Attoparsec.Time.Internal
101101
102+ -- GHC bundled libs
102103 build-depends:
103− attoparsec >= 0.13.0.1,
104− base >= 4.5 && < 5,
105− base-compat >= 0.9.1 && < 0.11,
106− containers >= 0.4.2,
107− deepseq >= 1.3 && < 1.5,
108− dlist >= 0.6,
109− ghc-prim >= 0.2,
110− hashable >= 1.1.2.0,
111− primitive >= 0.6.2.0 && < 0.7,
112− scientific >= 0.3.4.7 && < 0.4,
113− tagged >=0.8.3 && <0.9,
114− template-haskell >= 2.7,
115− text >= 1.2.3,
116− th-abstraction >= 0.2.2 && < 0.3,
117− time >= 1.1.1.4,
118− time-locale-compat >= 0.1.1 && < 0.2,
119− unordered-containers >= 0.2.5.0 && < 0.3,
120− uuid-types >= 1.0.3 && <1.1,
121− vector >= 0.8
104+ base >= 4.5.0.0 && < 5,
105+ containers >= 0.4.2.1 && < 0.7,
106+ deepseq >= 1.3.0.0 && < 1.5,
107+ ghc-prim >= 0.2 && < 0.6,
108+ template-haskell >= 2.7.0.0 && < 2.15,
109+ text >= 1.2.3.0 && < 1.3,
110+ time >= 1.4 && < 1.9
111+
112+ -- Compat
113+ build-depends:
114+ base-compat >= 0.9.1 && < 0.11
122115
123116 if flag(bytestring-builder)
124117 build-depends: bytestring >= 0.9.2 && < 0.10.4,
@@ -129,16 +122,35 @@ library
129122 if !impl(ghc >= 8.0)
130123 -- `Data.Semigroup` and `Control.Monad.Fail` and `Control.Monad.IO.Class` are available in base only since GHC 8.0 / base 4.9
131124 build-depends:
132− semigroups >= 0.18.2 && < 0.19,
133− transformers >= 0.2.2.0,
134− transformers-compat >= 0.3,
125+ semigroups >= 0.18.5 && < 0.19,
126+ transformers >= 0.3.0.0 && < 0.6,
127+ transformers-compat >= 0.6.2 && < 0.7,
135128 fail == 4.9.*
136129
137130 if !impl(ghc >= 7.10)
138131 -- `Numeric.Natural` is available in base only since GHC 7.10 / base 4.8
139− build-depends: nats >= 1 && < 1.2,
132+ build-depends: nats >= 1.1.1 && < 1.2,
140133 void >= 0.7.2 && < 0.8
141134
135+ -- cannot use latest version
136+ build-depends:
137+ unordered-containers >= 0.2.8.0 && < 0.3,
138+
139+ -- not in LTS-12.10
140+ tagged >= 0.8.5 && < 0.9,
141+ primitive >= 0.6.3.0 && < 0.7
142+
143+ -- Other dependencies
144+ build-depends:
145+ attoparsec >= 0.13.2.2 && < 0.14,
146+ dlist >= 0.8.0.4 && < 0.9,
147+ hashable >= 1.2.7.0 && < 1.3,
148+ scientific >= 0.3.6.2 && < 0.4,
149+ th-abstraction >= 0.2.8.0 && < 0.3,
150+ time-locale-compat >= 0.1.1.5 && < 0.2,
151+ uuid-types >= 1.0.3 && < 1.1,
152+ vector >= 0.12.0.1 && < 0.13
153+
142154 ghc-options: -Wall
143155
144156 if flag(developer)
benchmarks/Compare.hs+8−2
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE NoImplicitPrelude #-}
23{-# LANGUAGE ScopedTypeVariables #-}
34
@@ -6,16 +7,19 @@ module Main (main) where
67import Prelude.Compat
78
89import Compare.BufferBuilder ()
9−import Compare.JsonBuilder ()
1010import Criterion.Main
1111import Data.BufferBuilder.Json
12−import Data.Json.Builder
1312import Twitter
1413import Twitter.Manual ()
1514import Typed.Common
1615import qualified Data.Aeson as Aeson
1716import qualified Compare.JsonBench as JsonBench
1817
18+#ifdef MIN_VERSION_json_builder
19+import Data.Json.Builder
20+import Compare.JsonBuilder ()
21+#endif
22+
1923main :: IO ()
2024main =
2125 defaultMain [
@@ -23,7 +27,9 @@ main =
2327 bgroup "twitter" [
2428 bench "aeson" $ nf Aeson.encode twtr
2529 , bench "buffer-builder" $ nf encodeJson twtr
30+#ifdef MIN_VERSION_json_builder
2631 , bench "json-builder" $ nf toJsonLBS twtr
32+#endif
2733 ]
2834 , JsonBench.benchmarks
2935 ]
benchmarks/Compare/JsonBench.hs+8
@@ -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 ]
benchmarks/aeson-benchmarks.cabal+6−2
@@ -155,7 +155,6 @@ executable aeson-benchmark-compare
155155 other-modules:
156156 Compare.BufferBuilder
157157 Compare.JsonBench
158− Compare.JsonBuilder
159158 Twitter
160159 Twitter.Manual
161160 Typed.Common
@@ -168,9 +167,14 @@ executable aeson-benchmark-compare
168167 criterion >= 1.0,
169168 deepseq,
170169 ghc-prim,
171− json-builder,
172170 text
173171
172+ if impl(ghc < 8.4)
173+ other-modules:
174+ Compare.JsonBuilder
175+ build-depends:
176+ json-builder
177+
174178executable aeson-benchmark-micro
175179 default-language: Haskell2010
176180 main-is: Micro.hs
stack-bench.yaml+1−3
@@ -1,4 +1,4 @@
1−resolver: nightly-2018-03-12
1+resolver: lts-12.10
22# We use aeson in the snapshot to
33# - avoid recompilation of criterion
44# - compare against it
@@ -9,5 +9,3 @@ resolver: nightly-2018-03-12
99work-dir: .stack-work-bench
1010packages:
1111- benchmarks
12−extra-deps:
13−- aeson-1.3.1.0
stack-ffi-unescape.yaml+2−2
@@ -1,4 +1,4 @@
1−resolver: lts-10.0
1+resolver: lts-12.10
22packages:
33- '.'
44flags:
@@ -6,4 +6,4 @@ flags:
66 fast: true
77 cffi: true
88extra-deps:
9−- text-1.2.3.0
9+- hashable-time-0.2.0.1
stack-lts10.yamldeleted−9
@@ -1,9 +0,0 @@
1−resolver: lts-10.0
2−packages:
3−- '.'
4−flags:
5− aeson:
6− fast: true
7− cffi: false
8− attoparsec-iso8601:
9− fast: true
stack-lts12.yamlnew file+10
@@ -0,0 +1,10 @@
1+resolver: lts-12.10
2+packages:
3+- '.'
4+- attoparsec-iso8601
5+flags:
6+ aeson:
7+ fast: true
8+ cffi: true
9+extra-deps:
10+- hashable-time-0.2.0.1
stack-lts6.yamldeleted−23
@@ -1,23 +0,0 @@
1−resolver: lts-6.35
2−packages:
3−- '.'
4−- attoparsec-iso8601
5−extra-deps:
6−- semigroups-0.18.2
7−- tagged-0.8.5
8−- transformers-compat-0.5.1.4
9−- QuickCheck-2.10.0.1
10−- base-compat-0.9.3
11−- hashable-1.2.6.1
12−- integer-logarithms-1
13−- quickcheck-instances-0.3.16
14−- th-abstraction-0.2.2.0
15−- text-1.2.3.0
16−flags:
17−flags:
18− aeson:
19− fast: true
20− attoparsec-iso8601:
21− fast: true
22− semigroups:
23− bytestring-builder: false
stack-lts7.yamldeleted−17
@@ -1,17 +0,0 @@
1−resolver: lts-7.24
2−packages:
3−- '.'
4−- attoparsec-iso8601
5−extra-deps:
6−- QuickCheck-2.10.0.1
7−- base-compat-0.9.3
8−- hashable-1.2.6.1
9−- integer-logarithms-1
10−- quickcheck-instances-0.3.16
11−- th-abstraction-0.2.2.0
12−- text-1.2.3.0
13−flags:
14− aeson:
15− fast: true
16− attoparsec-iso8601:
17− fast: true
stack-lts8.yamldeleted−14
@@ -1,14 +0,0 @@
1−resolver: lts-8.24
2−packages:
3−- '.'
4−- attoparsec-iso8601
5−extra-deps:
6−- QuickCheck-2.10.0.1
7−- base-compat-0.9.3
8−- quickcheck-instances-0.3.16
9−- th-abstraction-0.2.2.0
10−flags:
11− aeson:
12− fast: true
13− attoparsec-iso8601:
14− fast: true
stack-lts9.yamldeleted−12
@@ -1,12 +0,0 @@
1−resolver: lts-9.9
2−packages:
3−- '.'
4−- attoparsec-iso8601
5−extra-deps:
6−- quickcheck-instances-0.3.16
7−- QuickCheck-2.10.0.1
8−flags:
9− aeson:
10− fast: true
11− attoparsec-iso8601:
12− fast: true
stack-nightly.yaml+1−1
@@ -1,4 +1,4 @@
1−resolver: nightly-2018-03-07
1+resolver: nightly-2018-09-26
22packages:
33- '.'
44- attoparsec-iso8601