git.iko.soy/typeable/hjsonpointer
on 723631d help sign in
.travis.yml+59−79
since splitsnapshots
unifiedsplit
@@ -1,104 +1,84 @@
1−# This Travis job script has been generated by a script via
1+# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
2#
2#
3−# runghc make_travis_yml_2.hs 'hjsonpointer.cabal'
4−#
5−# For more information, see https://github.com/hvr/multi-ghc-travis
6−
7−# NOTE: After generating comment out `cabal check`, it requires a description field.
3+# Manually modified to remove cabal check. I don't want a description field.
8
4
9language: c
5language: c
10sudo: false
6sudo: false
11
7
12−git:
13− submodules: false # whether to recursively clone submodules
14−
15cache:
8cache:
16 directories:
9 directories:
10+ - $HOME/.cabsnap
17 - $HOME/.cabal/packages
11 - $HOME/.cabal/packages
18− - $HOME/.cabal/store
19
12
20before_cache:
13before_cache:
21 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
14 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
22− # remove files that are regenerated by 'cabal update'
23− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
15+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
24− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
25− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
26− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
27− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
28−
29− - rm -rfv $HOME/.cabal/packages/head.hackage
30
16
31matrix:
17matrix:
32 include:
18 include:
33− - compiler: "ghc-8.0.2"
19+ - env: CABALVER=1.18 GHCVER=7.8.4
34− # env: TEST=--disable-tests BENCH=--disable-benchmarks
20+ compiler: ": #GHC 7.8.4"
35− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
21+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
36− - compiler: "ghc-8.2.2"
22+ - env: CABALVER=1.22 GHCVER=7.10.2
37− # env: TEST=--disable-tests BENCH=--disable-benchmarks
23+ compiler: ": #GHC 7.10.2"
38− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.2], sources: [hvr-ghc]}}
24+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
39− - compiler: "ghc-8.4.1"
25+ - env: CABALVER=1.24 GHCVER=8.0.1
40− # env: TEST=--disable-tests BENCH=--disable-benchmarks
26+ compiler: ": #GHC 8.0.1"
41− addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.4.1], sources: [hvr-ghc]}}
27+ addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}
42
28
43before_install:
29before_install:
44− - HC=${CC}
45− - HCPKG=${HC/ghc/ghc-pkg}
46− - unset CC
30+ - unset CC
47− - ROOTDIR=$(pwd)
48− - mkdir -p $HOME/.local/bin
49− - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
31+ - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
50− - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
51− - echo $HCNUMVER
52
32
53install:
33install:
54− - cabal --version
34+ - cabal --version
55− - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
35+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
56− - BENCH=${BENCH---enable-benchmarks}
36+ - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
57− - TEST=${TEST---enable-tests}
37+ then
58− - HADDOCK=${HADDOCK-true}
38+ zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
59− - INSTALLED=${INSTALLED-true}
39+ $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
60− - GHCHEAD=${GHCHEAD-false}
40+ fi
61− - travis_retry cabal update -v
41+ - travis_retry cabal update -v
62− - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
42+ - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
63− - rm -fv cabal.project cabal.project.local
43+ - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
64− - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
44+ - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
65− - "printf 'packages: \".\"\\n' > cabal.project"
45+
66− - cat cabal.project
46+# check whether current requested install-plan matches cached package-db snapshot
67− - if [ -f "./configure.ac" ]; then
47+ - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
68− (cd "." && autoreconf -i);
48+ then
69− fi
49+ echo "cabal build-cache HIT";
70− - rm -f cabal.project.freeze
50+ rm -rfv .ghc;
71− - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
51+ cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
72− - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
52+ cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
73− - rm -rf .ghc.environment.* "."/dist
53+ else
74− - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
54+ echo "cabal build-cache MISS";
55+ rm -rf $HOME/.cabsnap;
56+ mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
57+ cabal install --only-dependencies --enable-tests --enable-benchmarks;
58+ fi
59+
60+# snapshot package-db on cache miss
61+ - if [ ! -d $HOME/.cabsnap ];
62+ then
63+ echo "snapshotting package-db to build-cache";
64+ mkdir $HOME/.cabsnap;
65+ cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
66+ cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
67+ fi
75
68
76# Here starts the actual work to be performed for the package under test;
69# Here starts the actual work to be performed for the package under test;
77# any command which exits with a non-zero exit code causes the build to fail.
70# any command which exits with a non-zero exit code causes the build to fail.
78script:
71script:
79− # test that source-distributions can be generated
72+ - if [ -f configure.ac ]; then autoreconf -i; fi
80− - (cd "." && cabal sdist)
73+ - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
81− - mv "."/dist/hjsonpointer-*.tar.gz ${DISTDIR}/
82− - cd ${DISTDIR} || false
83− - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
84− - "printf 'packages: hjsonpointer-*/*.cabal\\n' > cabal.project"
85− - cat cabal.project
86− # this builds all libraries and executables (without tests/benchmarks)
74+ - cabal build # this builds all libraries and executables (including tests/benchmarks)
87− - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
75+ - cabal test
88−
76+ - cabal sdist # tests that a source-distribution can be generated
89− # Build with installed constraints for packages in global-db
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
91−
92− # build & run tests, build benchmarks
93− - cabal new-build -w ${HC} ${TEST} ${BENCH} all
94− - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi
95−
96− # cabal check
97− # - (cd hjsonpointer-* && cabal check)
98
77
99− # haddock
78+# Check that the resulting source distribution can be built & installed.
100− - rm -rf ./dist-newstyle
79+# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
101− - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
80+# `cabal install --force-reinstalls dist/*-*.tar.gz`
81+ - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
82+ (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
102
83
103−# REGENDATA ["hjsonpointer.cabal"]
104# EOF
84# EOF
changelog.md−21
@@ -1,24 +1,3 @@
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−
10−# 1.3.0
11−
12−+ Test with GHC 8.2. Drop GHC 7.8.
13−
14−# 1.2.0
15−
16−+ Track upper bounds in a Hackage revision instead of source code.
17−
18−# 1.1.1
19−
20−+ Bump aeson.
21−
22# 1.1.0.2
1# 1.1.0.2
23
2
24+ Raise test dep upper bounds.
3+ Raise test dep upper bounds.
hjsonpointer.cabal+16−12
@@ -1,5 +1,5 @@
1name: hjsonpointer
1name: hjsonpointer
2−version: 1.5.0
2+version: 1.1.0.2
3synopsis: JSON Pointer library
3synopsis: JSON Pointer library
4homepage: https://github.com/seagreen/hjsonpointer
4homepage: https://github.com/seagreen/hjsonpointer
5license: MIT
5license: MIT
@@ -9,8 +9,6 @@ maintainer: ian@housejeffries.com
9category: Data
9category: 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:
13−Tested-With: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1
14extra-source-files:
12extra-source-files:
15 changelog.md
13 changelog.md
16 README.md
14 README.md
@@ -24,12 +22,15 @@ library
24 exposed-modules:
22 exposed-modules:
25 JSONPointer
23 JSONPointer
26 build-depends:
24 build-depends:
27− base >= 4.9 && < 5
25+ base >= 4.6 && < 4.10
28− , aeson >= 0.7
26+ , aeson >= 0.7 && < 1.2
29− , hashable >= 1.2
27+ , hashable >= 1.2 && < 1.3
28+ , QuickCheck >= 2.8 && < 2.10
30− , unordered-containers >= 0.2
29+ , unordered-containers >= 0.2 && < 0.3
30+ , semigroups >= 0.18 && < 1.0
31+ -- ^ for GHCs < 8
31− , text >= 1.2
32+ , text >= 1.2 && < 1.3
32− , vector >= 0.10
33+ , vector >= 0.10 && < 1.0
33
34
34test-suite unit
35test-suite unit
35 hs-source-dirs:
36 hs-source-dirs:
@@ -42,15 +43,18 @@ test-suite unit
42 OverloadedStrings
43 OverloadedStrings
43 ghc-options:
44 ghc-options:
44 -Wall
45 -Wall
45− -fno-warn-orphans
46 other-modules: Example
46 other-modules: Example
47 build-depends:
47 build-depends:
48 aeson
48 aeson
49 , base
49 , base
50 , hjsonpointer
50 , hjsonpointer
51− , hspec >= 2.2
51+ , hspec >= 2.2 && < 3.0
52− , http-types >= 0.8
52+ , http-types >= 0.8 && < 1.0
53 , QuickCheck
53 , QuickCheck
54 , unordered-containers
54 , unordered-containers
55 , text
55 , text
56 , vector
56 , vector
57+
58+source-repository head
59+ type: git
60+ location: git://github.com/seagreen/hjsonpointer.git
shell.nixdeleted−9
@@ -1,9 +0,0 @@
1−{ghc}:
2−with (import <nixpkgs> {});
3−
4−haskell.lib.buildStackProject {
5− name = "none";
6− inherit ghc;
7− buildInputs = [
8− ];
9−}
src/JSONPointer.hs+11−2
@@ -13,8 +13,14 @@ 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
16import Text.Read (readMaybe)
17import Text.Read (readMaybe)
17
18
19+-- For GHCs before 7.10:
20+import Control.Applicative
21+import Data.Monoid
22+import Data.Traversable
23+
18--------------------------------------------------
24--------------------------------------------------
19-- * Resolution
25-- * Resolution
20--------------------------------------------------
26--------------------------------------------------
@@ -36,7 +42,7 @@ resolve (Pointer (t:ts)) v = resolveToken t v >>= resolve (Pointer ts)
36
42
37newtype Pointer
43newtype Pointer
38 = Pointer { _unPointer :: [Token] }
44 = Pointer { _unPointer :: [Token] }
39− deriving (Eq, Show, Semigroup, Monoid, Generic)
45+ deriving (Eq, Show, Semigroup, Monoid, Generic, Arbitrary)
40
46
41instance HA.Hashable Pointer
47instance HA.Hashable Pointer
42
48
@@ -62,6 +68,9 @@ newtype Token
62
68
63instance HA.Hashable Token
69instance HA.Hashable Token
64
70
71+instance Arbitrary Token where
72+ arbitrary = Token . T.pack <$> arbitrary
73+
65-- | This escapes @"/"@ (because it's the token separator character).
74-- | This escapes @"/"@ (because it's the token separator character).
66--
75--
67-- It also escapes @"~"@ (because it's the escape character).
76-- It also escapes @"~"@ (because it's the escape character).
@@ -103,7 +112,7 @@ unescape txt =
103--------------------------------------------------
112--------------------------------------------------
104-- * Wrapper Types
113-- * Wrapper Types
105--
114--
106−-- $ These aren't used by the rest of the library
115+-- These aren't used by the rest of the library
107-- (as explained in the docs for 'Token').
116-- (as explained in the docs for 'Token').
108--
117--
109-- However, they might be useful if you need to distinguish JSON Pointer
118-- However, they might be useful if you need to distinguish JSON Pointer
stack.yamldeleted−2
@@ -1,2 +0,0 @@
1−resolver: lts-12.10
2−pvp-bounds: upper-revision
test/Unit.hs+8−12
@@ -1,28 +1,24 @@
1−{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2−{-# LANGUAGE StandaloneDeriving #-}
3
1
4module Main where
2module Main where
5
3
4+import Control.Arrow
6import Data.Aeson
5import Data.Aeson
7−import Data.Bifunctor (first)
8−import Data.Foldable
9−import Data.Monoid
10import Data.Text (Text)
6import Data.Text (Text)
11import qualified Data.Text as T
7import qualified Data.Text as T
12−import Data.Text.Encoding (decodeUtf8, encodeUtf8)
8+import Data.Text.Encoding
13import qualified Data.Vector as V
9import qualified Data.Vector as V
14import qualified JSONPointer as JP
10import qualified JSONPointer as JP
15import Network.HTTP.Types.URI (urlDecode)
11import Network.HTTP.Types.URI (urlDecode)
16
12
17import Test.Hspec
13import Test.Hspec
18−import Test.QuickCheck (Arbitrary(..), property)
14+import Test.QuickCheck (property)
19−
20−import qualified Example
21
15
22−deriving instance Arbitrary JP.Pointer
16+-- For GHCs before 7.10:
17+import Control.Applicative
18+import Data.Foldable
19+import Data.Monoid
23
20
24−instance Arbitrary JP.Token where
21+import qualified Example
25− arbitrary = JP.Token . T.pack <$> arbitrary
26
22
27main :: IO ()
23main :: IO ()
28main = hspec $ do
24main = hspec $ do