Skip to content

Commit e79a7ca

Browse files
committed
Use Decoding parsers as default
Move Data.Aeson.Parser(.Internal) into new package attoparsec-aeson Update tests and benchmarks (mostly cleanup). Very few error messages are now different, e.g. on unexpected end-of-input.
1 parent 3e6cee2 commit e79a7ca

34 files changed

+357
-342
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ jobs:
213213
touch cabal.project
214214
echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
215215
echo "packages: $GITHUB_WORKSPACE/source/attoparsec-iso8601" >> cabal.project
216+
echo "packages: $GITHUB_WORKSPACE/source/attoparsec-aeson" >> cabal.project
216217
echo "packages: $GITHUB_WORKSPACE/source/text-iso8601" >> cabal.project
217218
echo "packages: $GITHUB_WORKSPACE/source/examples" >> cabal.project
218219
echo "packages: $GITHUB_WORKSPACE/source/benchmarks" >> cabal.project
@@ -231,6 +232,8 @@ jobs:
231232
echo "PKGDIR_aeson=${PKGDIR_aeson}" >> "$GITHUB_ENV"
232233
PKGDIR_attoparsec_iso8601="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/attoparsec-iso8601-[0-9.]*')"
233234
echo "PKGDIR_attoparsec_iso8601=${PKGDIR_attoparsec_iso8601}" >> "$GITHUB_ENV"
235+
PKGDIR_attoparsec_aeson="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/attoparsec-aeson-[0-9.]*')"
236+
echo "PKGDIR_attoparsec_aeson=${PKGDIR_attoparsec_aeson}" >> "$GITHUB_ENV"
234237
PKGDIR_text_iso8601="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/text-iso8601-[0-9.]*')"
235238
echo "PKGDIR_text_iso8601=${PKGDIR_text_iso8601}" >> "$GITHUB_ENV"
236239
PKGDIR_aeson_examples="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/aeson-examples-[0-9.]*')"
@@ -242,13 +245,16 @@ jobs:
242245
touch cabal.project.local
243246
echo "packages: ${PKGDIR_aeson}" >> cabal.project
244247
echo "packages: ${PKGDIR_attoparsec_iso8601}" >> cabal.project
248+
echo "packages: ${PKGDIR_attoparsec_aeson}" >> cabal.project
245249
echo "packages: ${PKGDIR_text_iso8601}" >> cabal.project
246250
echo "packages: ${PKGDIR_aeson_examples}" >> cabal.project
247251
echo "packages: ${PKGDIR_aeson_benchmarks}" >> cabal.project
248252
echo "package aeson" >> cabal.project
249253
echo " ghc-options: -Werror=missing-methods" >> cabal.project
250254
echo "package attoparsec-iso8601" >> cabal.project
251255
echo " ghc-options: -Werror=missing-methods" >> cabal.project
256+
echo "package attoparsec-aeson" >> cabal.project
257+
echo " ghc-options: -Werror=missing-methods" >> cabal.project
252258
echo "package text-iso8601" >> cabal.project
253259
echo " ghc-options: -Werror=missing-methods" >> cabal.project
254260
echo "package aeson-examples" >> cabal.project
@@ -258,7 +264,7 @@ jobs:
258264
cat >> cabal.project <<EOF
259265
allow-newer: hermes-json:attoparsec-iso8601
260266
EOF
261-
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(aeson|aeson-benchmarks|aeson-examples|attoparsec-iso8601|text-iso8601)$/; }' >> cabal.project.local
267+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(aeson|aeson-benchmarks|aeson-examples|attoparsec-aeson|attoparsec-iso8601|text-iso8601)$/; }' >> cabal.project.local
262268
cat cabal.project
263269
cat cabal.project.local
264270
- name: dump install plan
@@ -286,8 +292,9 @@ jobs:
286292
cabal-docspec $ARG_COMPILER
287293
- name: hlint
288294
run: |
289-
if [ $((HCNUMVER >= 90200 && HCNUMVER < 90400)) -ne 0 ] ; then (cd ${PKGDIR_aeson} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 src attoparsec-iso8601/src src-pure) ; fi
295+
if [ $((HCNUMVER >= 90200 && HCNUMVER < 90400)) -ne 0 ] ; then (cd ${PKGDIR_aeson} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 src) ; fi
290296
if [ $((HCNUMVER >= 90200 && HCNUMVER < 90400)) -ne 0 ] ; then (cd ${PKGDIR_attoparsec_iso8601} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 src) ; fi
297+
if [ $((HCNUMVER >= 90200 && HCNUMVER < 90400)) -ne 0 ] ; then (cd ${PKGDIR_attoparsec_aeson} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 src) ; fi
291298
if [ $((HCNUMVER >= 90200 && HCNUMVER < 90400)) -ne 0 ] ; then (cd ${PKGDIR_text_iso8601} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 src) ; fi
292299
if [ $((HCNUMVER >= 90200 && HCNUMVER < 90400)) -ne 0 ] ; then (cd ${PKGDIR_aeson_examples} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 src/) ; fi
293300
if [ $((HCNUMVER >= 90200 && HCNUMVER < 90400)) -ne 0 ] ; then (cd ${PKGDIR_aeson_benchmarks} && hlint -h ${GITHUB_WORKSPACE}/source/.hlint.yaml -XHaskell2010 .) ; fi

.hlint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- ignore:
3131
name: "Unused LANGUAGE pragma"
3232
within:
33+
- Data.Aeson.Internal.ByteString
3334
- Data.Aeson.Internal.Text
3435
- Compare.JsonBench
3536

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
lint:
2-
./run-hlint.sh --cpp-include include/ src/ attoparsec-iso8601/ benchmarks/ examples/ src-pure/ tests/ text-iso8601/src text-iso8601/tests
2+
./run-hlint.sh --cpp-include include/ src/ attoparsec-iso8601/ benchmarks/ examples/ tests/ text-iso8601/src text-iso8601/tests attoparsec-aeson/src

aeson.cabal

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ extra-source-files:
4040
benchmarks/json-data/*.json
4141
changelog.md
4242
README.markdown
43-
src-pure/Data/Aeson/Parser/*.hs
4443
tests/golden/*.expected
4544
tests/JSONTestSuite/results/*.tok
4645
tests/JSONTestSuite/results/*.txt
@@ -54,7 +53,7 @@ flag ordered-keymap
5453

5554
library
5655
default-language: Haskell2010
57-
hs-source-dirs: src attoparsec-iso8601/src
56+
hs-source-dirs: src
5857
exposed-modules:
5958
Data.Aeson
6059
Data.Aeson.Decoding
@@ -65,31 +64,28 @@ library
6564
Data.Aeson.Encoding.Internal
6665
Data.Aeson.Key
6766
Data.Aeson.KeyMap
68-
Data.Aeson.Parser
69-
Data.Aeson.Parser.Internal
7067
Data.Aeson.QQ.Simple
7168
Data.Aeson.Text
7269
Data.Aeson.TH
7370
Data.Aeson.Types
7471

7572
other-modules:
73+
Data.Aeson.Decoding.Conversion
7674
Data.Aeson.Decoding.Internal
7775
Data.Aeson.Encoding.Builder
7876
Data.Aeson.Internal.ByteString
7977
Data.Aeson.Internal.Functions
8078
Data.Aeson.Internal.Prelude
8179
Data.Aeson.Internal.Text
8280
Data.Aeson.Internal.TH
81+
Data.Aeson.Internal.Unescape
8382
Data.Aeson.Internal.Word8
8483
Data.Aeson.Parser.Time
85-
Data.Aeson.Parser.Unescape
8684
Data.Aeson.Types.Class
8785
Data.Aeson.Types.FromJSON
8886
Data.Aeson.Types.Generic
8987
Data.Aeson.Types.Internal
9088
Data.Aeson.Types.ToJSON
91-
Data.Attoparsec.Time
92-
Data.Attoparsec.Time.Internal
9389

9490
-- GHC bundled libs
9591
build-depends:
@@ -138,8 +134,6 @@ library
138134
ghc-options: -Wall
139135

140136
-- String unescaping
141-
hs-source-dirs: src-pure
142-
other-modules: Data.Aeson.Parser.UnescapePure
143137

144138
if flag(ordered-keymap)
145139
cpp-options: -DUSE_ORDEREDMAP=1

attoparsec-aeson/LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright (c) 2011, MailRank, Inc.
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions
7+
are met:
8+
9+
1. Redistributions of source code must retain the above copyright
10+
notice, this list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright
13+
notice, this list of conditions and the following disclaimer in the
14+
documentation and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the author nor the names of his contributors
17+
may be used to endorse or promote products derived from this software
18+
without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
21+
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
24+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30+
POSSIBILITY OF SUCH DAMAGE.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
cabal-version: 1.12
2+
name: attoparsec-aeson
3+
version: 2.2
4+
synopsis: Parsing of aeson's Value with attoparsec
5+
description:
6+
Parsing of aeson's Value with attoparsec, originally from aeson.
7+
8+
license: BSD3
9+
license-file: LICENSE
10+
category: Parsing
11+
copyright:
12+
(c) 2011-2016 Bryan O'Sullivan
13+
(c) 2011 MailRank, Inc.
14+
15+
author: Bryan O'Sullivan <[email protected]>
16+
maintainer: Oleg Grenrus <[email protected]>
17+
stability: experimental
18+
homepage: https://github.com/haskell/aeson
19+
bug-reports: https://github.com/haskell/aeson/issues
20+
build-type: Simple
21+
tested-with:
22+
GHC ==8.2.2
23+
|| ==8.4.4
24+
|| ==8.6.5
25+
|| ==8.8.4
26+
|| ==8.10.7
27+
|| ==9.0.2
28+
|| ==9.2.8
29+
|| ==9.4.5
30+
|| ==9.6.2
31+
32+
library
33+
hs-source-dirs: src
34+
default-language: Haskell2010
35+
ghc-options: -Wall
36+
exposed-modules:
37+
Data.Aeson.Parser
38+
Data.Aeson.Parser.Internal
39+
40+
other-modules:
41+
Data.Aeson.Internal.ByteString
42+
Data.Aeson.Internal.Text
43+
Data.Aeson.Internal.Word8
44+
45+
build-depends:
46+
aeson >=2.2 && <2.3
47+
, attoparsec >=0.14.2 && <0.15
48+
, base >=4.10.0.0 && <5
49+
, bytestring >=0.10.8.2 && <0.12
50+
, integer-conversion >=0.1 && <0.2
51+
, primitive >=0.8.0.0 && <0.9
52+
, scientific >=0.3.7.0 && <0.4
53+
, text >=1.2.3.0 && <1.3 || >=2.0 && <2.1
54+
, vector >=0.12.0.1 && <0.14
55+
56+
source-repository head
57+
type: git
58+
location: git://github.com/haskell/aeson.git
59+
subdir: attoparsec-aeson
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/Data/Aeson/Internal/ByteString.hs
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/Data/Aeson/Internal/Text.hs
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/Data/Aeson/Internal/Word8.hs
File renamed without changes.

0 commit comments

Comments
 (0)