git.iko.soy/typeable/hjsonpointer
on master help sign in
.travis.yml+61−52
since splitsnapshots
unifiedsplit
@@ -1,9 +1,11 @@
1# This Travis job script has been generated by a script via
1# This Travis job script has been generated by a script via
2#
2#
3−# make_travis_yml_2.hs 'hjsonpointer.cabal'
3+# runghc make_travis_yml_2.hs 'hjsonpointer.cabal'
4#
4#
5# For more information, see https://github.com/hvr/multi-ghc-travis
5# For more information, see https://github.com/hvr/multi-ghc-travis
6−#
6+
7+# NOTE: After generating comment out `cabal check`, it requires a description field.
8+
7language: c
9language: c
8sudo: false
10sudo: false
9
11
@@ -24,72 +26,79 @@ before_cache:
24 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
26 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
25 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
27 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
26
28
29+ - rm -rfv $HOME/.cabal/packages/head.hackage
30+
27matrix:
31matrix:
28 include:
32 include:
29− - compiler: "ghc-7.10.3"
33+ - compiler: "ghc-8.0.2"
30 # env: TEST=--disable-tests BENCH=--disable-benchmarks
34 # env: TEST=--disable-tests BENCH=--disable-benchmarks
31− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.3], sources: [hvr-ghc]}}
35+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
32− - compiler: "ghc-8.0.1"
36+ - compiler: "ghc-8.2.2"
33 # env: TEST=--disable-tests BENCH=--disable-benchmarks
37 # env: TEST=--disable-tests BENCH=--disable-benchmarks
34− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.1], sources: [hvr-ghc]}}
38+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.2], sources: [hvr-ghc]}}
35− - compiler: "ghc-8.2.1"
39+ - compiler: "ghc-8.4.1"
36 # env: TEST=--disable-tests BENCH=--disable-benchmarks
40 # env: TEST=--disable-tests BENCH=--disable-benchmarks
37− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}}
41+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.4.1], sources: [hvr-ghc]}}
38
42
39before_install:
43before_install:
40− - HC=${CC}
44+ - HC=${CC}
41− - HCPKG=${HC/ghc/ghc-pkg}
45+ - HCPKG=${HC/ghc/ghc-pkg}
42− - unset CC
46+ - unset CC
47+ - ROOTDIR=$(pwd)
48+ - mkdir -p $HOME/.local/bin
43− - PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
49+ - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
44− - PKGNAME='hjsonpointer'
50+ - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
51+ - echo $HCNUMVER
45
52
46install:
53install:
47− - cabal --version
54+ - cabal --version
48− - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
55+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
49− - BENCH=${BENCH---enable-benchmarks}
56+ - BENCH=${BENCH---enable-benchmarks}
50− - TEST=${TEST---enable-tests}
57+ - TEST=${TEST---enable-tests}
51− - HADDOCK=${HADDOCK-true}
58+ - HADDOCK=${HADDOCK-true}
52− - INSTALLED=${INSTALLED-true}
59+ - INSTALLED=${INSTALLED-true}
60+ - GHCHEAD=${GHCHEAD-false}
53− - travis_retry cabal update -v
61+ - travis_retry cabal update -v
54− - sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
62+ - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
55− - rm -fv cabal.project.local
63+ - rm -fv cabal.project cabal.project.local
64+ - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
56− - "echo 'packages: .' > cabal.project"
65+ - "printf 'packages: \".\"\\n' > cabal.project"
66+ - cat cabal.project
67+ - if [ -f "./configure.ac" ]; then
68+ (cd "." && autoreconf -i);
69+ fi
57− - rm -f cabal.project.freeze
70+ - rm -f cabal.project.freeze
58− - cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all
71+ - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
59− - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all
72+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
73+ - rm -rf .ghc.environment.* "."/dist
74+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
60
75
61# Here starts the actual work to be performed for the package under test;
76# Here starts the actual work to be performed for the package under test;
62# any command which exits with a non-zero exit code causes the build to fail.
77# any command which exits with a non-zero exit code causes the build to fail.
63script:
78script:
64− - if [ -f configure.ac ]; then autoreconf -i; fi
65− - rm -rf .ghc.environment.* dist/
66− - cabal sdist # test that a source-distribution can be generated
79+ # test that source-distributions can be generated
67− - cd dist/
80+ - (cd "." && cabal sdist)
68− - SRCTAR=(${PKGNAME}-*.tar.gz)
81+ - mv "."/dist/hjsonpointer-*.tar.gz ${DISTDIR}/
69− - SRC_BASENAME="${SRCTAR/%.tar.gz}"
82+ - cd ${DISTDIR} || false
70− - tar -xvf "./$SRC_BASENAME.tar.gz"
83+ - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
71− - cd "$SRC_BASENAME/"
72−## from here on, CWD is inside the extracted source-tarball
73− - rm -fv cabal.project.local
74− - "echo 'packages: .' > cabal.project"
84+ - "printf 'packages: hjsonpointer-*/*.cabal\\n' > cabal.project"
85+ - cat cabal.project
75− # this builds all libraries and executables (without tests/benchmarks)
86+ # this builds all libraries and executables (without tests/benchmarks)
76− - rm -f cabal.project.freeze
87+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
77− - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
88+
78− # this builds all libraries and executables (including tests/benchmarks)
89+ # Build with installed constraints for packages in global-db
79− # - rm -rf ./dist-newstyle
90+ - if $INSTALLED; then echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh; else echo "Not building with installed constraints"; fi
80
91
81− # Build with installed constraints for packages in global-db
92+ # build & run tests, build benchmarks
82− - if $INSTALLED; then
93+ - cabal new-build -w ${HC} ${TEST} ${BENCH} all
83− echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh;
94+ - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
84− else echo "Not building with installed constraints"; fi
85
95
86− # build & run tests, build benchmarks
96+ # cabal check
87− - cabal new-build -w ${HC} ${TEST} ${BENCH} all
97+ # - (cd hjsonpointer-* && cabal check)
88− - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi
89
98
90− # haddock
99+ # haddock
91− - rm -rf ./dist-newstyle
100+ - rm -rf ./dist-newstyle
92− - if $HADDOCK; then cabal new-haddock -w ${HC} --disable-tests --disable-benchmarks all; else echo "Skipping haddock generation";fi
101+ - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
93
102
94# REGENDATA ["hjsonpointer.cabal"]
103# REGENDATA ["hjsonpointer.cabal"]
95# EOF
104# EOF
changelog.md+9
@@ -1,3 +1,12 @@
1+# 1.5.0
2+
3++ Drop QuickCheck dependency (thanks @mmhat !).
4+
5+# 1.4.0
6+
7++ Enable GHC 8.4 (thanks @4e6 !).
8++ Drop GHC 7.10.
9+
1# 1.3.0
10# 1.3.0
2
11
3+ Test with GHC 8.2. Drop GHC 7.8.
12+ Test with GHC 8.2. Drop GHC 7.8.
hjsonpointer.cabal+4−6
@@ -1,5 +1,5 @@
1name: hjsonpointer
1name: hjsonpointer
2−version: 1.3.0
2+version: 1.5.0
3synopsis: JSON Pointer library
3synopsis: JSON Pointer library
4homepage: https://github.com/seagreen/hjsonpointer
4homepage: https://github.com/seagreen/hjsonpointer
5license: MIT
5license: MIT
@@ -10,7 +10,7 @@ category: Data
10build-type: Simple
10build-type: Simple
11cabal-version: >=1.10
11cabal-version: >=1.10
12-- Rerun multi-ghc-travis (executable make-travis-yml-2) after changing:
12-- Rerun multi-ghc-travis (executable make-travis-yml-2) after changing:
13−Tested-With: GHC == 7.10.3, GHC == 8.0.1, GHC == 8.2.1
13+Tested-With: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1
14extra-source-files:
14extra-source-files:
15 changelog.md
15 changelog.md
16 README.md
16 README.md
@@ -24,13 +24,10 @@ library
24 exposed-modules:
24 exposed-modules:
25 JSONPointer
25 JSONPointer
26 build-depends:
26 build-depends:
27− base >= 4.6 && < 4.11
27+ base >= 4.9 && < 5
28 , aeson >= 0.7
28 , aeson >= 0.7
29 , hashable >= 1.2
29 , hashable >= 1.2
30− , QuickCheck >= 2.8
31 , unordered-containers >= 0.2
30 , unordered-containers >= 0.2
32− , semigroups >= 0.18
33− -- ^ for GHCs < 8
34 , text >= 1.2
31 , text >= 1.2
35 , vector >= 0.10
32 , vector >= 0.10
36
33
@@ -45,6 +42,7 @@ test-suite unit
45 OverloadedStrings
42 OverloadedStrings
46 ghc-options:
43 ghc-options:
47 -Wall
44 -Wall
45+ -fno-warn-orphans
48 other-modules: Example
46 other-modules: Example
49 build-depends:
47 build-depends:
50 aeson
48 aeson
src/JSONPointer.hs+1−5
@@ -13,7 +13,6 @@ import Data.Text (Text)
13import qualified Data.Text as T
13import qualified Data.Text as T
14import qualified Data.Vector as V
14import qualified Data.Vector as V
15import GHC.Generics (Generic)
15import GHC.Generics (Generic)
16−import Test.QuickCheck
17import Text.Read (readMaybe)
16import Text.Read (readMaybe)
18
17
19--------------------------------------------------
18--------------------------------------------------
@@ -37,7 +36,7 @@ resolve (Pointer (t:ts)) v = resolveToken t v >>= resolve (Pointer ts)
37
36
38newtype Pointer
37newtype Pointer
39 = Pointer { _unPointer :: [Token] }
38 = Pointer { _unPointer :: [Token] }
40− deriving (Eq, Show, Semigroup, Monoid, Generic, Arbitrary)
39+ deriving (Eq, Show, Semigroup, Monoid, Generic)
41
40
42instance HA.Hashable Pointer
41instance HA.Hashable Pointer
43
42
@@ -63,9 +62,6 @@ newtype Token
63
62
64instance HA.Hashable Token
63instance HA.Hashable Token
65
64
66−instance Arbitrary Token where
67− arbitrary = Token . T.pack <$> arbitrary
68−
69-- | This escapes @"/"@ (because it's the token separator character).
65-- | This escapes @"/"@ (because it's the token separator character).
70--
66--
71-- It also escapes @"~"@ (because it's the escape character).
67-- It also escapes @"~"@ (because it's the escape character).
stack.yaml+1−1
@@ -1,2 +1,2 @@
1−resolver: nightly-2017-09-18
1+resolver: lts-12.10
2pvp-bounds: upper-revision
2pvp-bounds: upper-revision
test/Unit.hs+8−1
@@ -1,3 +1,5 @@
1+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2+{-# LANGUAGE StandaloneDeriving #-}
1
3
2module Main where
4module Main where
3
5
@@ -13,10 +15,15 @@ import qualified JSONPointer as JP
13import Network.HTTP.Types.URI (urlDecode)
15import Network.HTTP.Types.URI (urlDecode)
14
16
15import Test.Hspec
17import Test.Hspec
16−import Test.QuickCheck (property)
18+import Test.QuickCheck (Arbitrary(..), property)
17
19
18import qualified Example
20import qualified Example
19
21
22+deriving instance Arbitrary JP.Pointer
23+
24+instance Arbitrary JP.Token where
25+ arbitrary = JP.Token . T.pack <$> arbitrary
26+
20main :: IO ()
27main :: IO ()
21main = hspec $ do
28main = hspec $ do
22 describe "example" $ do
29 describe "example" $ do