git.iko.soy/monoidal-containers
on master help sign in
Compatibility with GHC 8.4.1
e0302a4Ben Gamari
.travis.yml+102−45
@@ -1,8 +1,15 @@
1−# This file has been generated by `make_travis_yml_2.hs`
1+# This Travis job script has been generated by a script via
2+#
3+# runghc make_travis_yml_2.hs 'monoidal-containers.cabal'
4+#
2−# see https://github.com/hvr/multi-ghc-travis for more information
5+# For more information, see https://github.com/hvr/multi-ghc-travis
6+#
3language: c
7language: c
4sudo: false
8sudo: false
5
9
10+git:
11+ submodules: false # whether to recursively clone submodules
12+
6cache:
13cache:
7 directories:
14 directories:
8 - $HOME/.cabal/packages
15 - $HOME/.cabal/packages
@@ -10,59 +17,109 @@ cache:
10
17
11before_cache:
18before_cache:
12 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
19 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
20+ # remove files that are regenerated by 'cabal update'
13− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
21+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
22+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
23+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
24+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
25+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
26+
27+ - rm -rfv $HOME/.cabal/packages/head.hackage
14
28
15matrix:
29matrix:
16 include:
30 include:
17− - env: CABALVER=1.24 GHCVER=7.6.3
31+ - compiler: "ghc-7.6.3"
18− compiler: ": #GHC 7.6.3"
32+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
19− addons: {apt: {packages: [cabal-install-1.24,ghc-7.6.3], sources: [hvr-ghc]}}
33+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.6.3], sources: [hvr-ghc]}}
20− - env: CABALVER=1.24 GHCVER=7.8.4
34+ - compiler: "ghc-7.8.4"
21− compiler: ": #GHC 7.8.4"
35+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
36+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.8.4], sources: [hvr-ghc]}}
37+ - compiler: "ghc-8.0.2"
38+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
22− addons: {apt: {packages: [cabal-install-1.24,ghc-7.8.4], sources: [hvr-ghc]}}
39+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
23− - env: CABALVER=1.24 GHCVER=8.0.1
40+ - compiler: "ghc-8.2.2"
41+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
42+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.2], sources: [hvr-ghc]}}
24− compiler: ": #GHC 8.0.1"
43+ - compiler: "ghc-8.4.1"
44+ env: GHCHEAD=true
25− addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}
45+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.4.1], sources: [hvr-ghc]}}
46+
47+ allow_failures:
48+ - compiler: "ghc-8.4.1"
26
49
27before_install:
50before_install:
51+ - HC=${CC}
52+ - HCPKG=${HC/ghc/ghc-pkg}
28− - unset CC
53+ - unset CC
54+ - ROOTDIR=$(pwd)
55+ - mkdir -p $HOME/.local/bin
29− - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
56+ - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
57+ - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
58+ - echo $HCNUMVER
30
59
31install:
60install:
32− - cabal --version
61+ - cabal --version
33− - BENCH=${BENCH---enable-benchmarks}
34− - TEST=${TEST---enable-tests}
35− - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
62+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
36− - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
63+ - BENCH=${BENCH---enable-benchmarks}
37− then
64+ - TEST=${TEST---enable-tests}
38− zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
65+ - HADDOCK=${HADDOCK-true}
39− $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
66+ - INSTALLED=${INSTALLED-true}
40− fi
67+ - GHCHEAD=${GHCHEAD-false}
41− - travis_retry cabal update -v
68+ - travis_retry cabal update -v
42− - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
69+ - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
70+ - rm -fv cabal.project cabal.project.local
71+ # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage
72+ - |
73+ if $GHCHEAD; then
74+ sed -i.bak 's/-- allow-newer:.*/allow-newer: *:base, *:template-haskell, *:ghc, *:Cabal/' ${HOME}/.cabal/config
75+
76+ echo 'repository head.hackage' >> ${HOME}/.cabal/config
77+ echo ' url: http://head.hackage.haskell.org/' >> ${HOME}/.cabal/config
78+ echo ' secure: True' >> ${HOME}/.cabal/config
79+ echo ' root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config
80+ echo ' 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config
81+ echo ' 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config
82+ echo ' key-threshold: 3' >> ${HOME}/.cabal.config
83+
84+ cabal new-update head.hackage -v
85+ fi
86+ - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
87+ - "printf 'packages: \".\"\\n' > cabal.project"
88+ - cat cabal.project
89+ - if [ -f "./configure.ac" ]; then
90+ (cd "." && autoreconf -i);
91+ fi
92+ - rm -f cabal.project.freeze
43− - cabal new-build ${TEST} ${BENCH} --dep
93+ - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
94+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
95+ - rm -rf .ghc.environment.* "."/dist
96+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
44
97
45# Here starts the actual work to be performed for the package under test;
98# Here starts the actual work to be performed for the package under test;
46# any command which exits with a non-zero exit code causes the build to fail.
99# any command which exits with a non-zero exit code causes the build to fail.
47script:
100script:
48− - if [ -f configure.ac ]; then autoreconf -i; fi
101+ # test that source-distributions can be generated
102+ - (cd "." && cabal sdist)
103+ - mv "."/dist/monoidal-containers-*.tar.gz ${DISTDIR}/
104+ - cd ${DISTDIR} || false
105+ - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
106+ - "printf 'packages: monoidal-containers-*/*.cabal\\n' > cabal.project"
107+ - cat cabal.project
49− # this builds all libraries and executables (including tests/benchmarks)
108+ # this builds all libraries and executables (without tests/benchmarks)
50− - cabal new-build ${TEST} ${BENCH} -v2 # -v2 provides useful information for debugging
109+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
51−
110+
52− # there's no 'cabal new-test' yet, so let's emulate for now
111+ # Build with installed constraints for packages in global-db
53− - TESTS=( $(awk 'tolower($0) ~ /^test-suite / { print $2 }' *.cabal) );
112+ - 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
54− RC=true; for T in ${TESTS[@]}; do echo "== $T ==";
113+
55− if dist-newstyle/build/*/build/$T/$T; then echo "= $T OK =";
114+ # build & run tests, build benchmarks
56− else echo "= $T FAILED ="; RC=false; fi; done; $RC
115+ - cabal new-build -w ${HC} ${TEST} ${BENCH} all
57− - cabal sdist # test that a source-distribution can be generated
116+
58−
117+ # cabal check
59− # Check that the resulting source distribution can be built w/o and w tests
118+ - (cd monoidal-containers-* && cabal check)
60− - SRC_BASENAME=$(cabal info . | awk '{print $2;exit}')
119+
61− - tar -C dist/ -xf dist/$SRC_BASENAME.tar.gz
120+ # haddock
62− - "echo 'packages: *.cabal' > dist/$SRC_BASENAME/cabal.project"
63− - cd dist/$SRC_BASENAME/
64− - cabal new-build --disable-tests --disable-benchmarks
65− - rm -rf ./dist-newstyle
121+ - rm -rf ./dist-newstyle
66− - cabal new-build ${TEST} ${BENCH}
122+ - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
67
123
124+# REGENDATA ["monoidal-containers.cabal"]
68# EOF
125# EOF
monoidal-containers.cabal+4−3
@@ -23,7 +23,7 @@ copyright: (c) 2014 Ben Gamari
23category: Data
23category: Data
24build-type: Simple
24build-type: Simple
25cabal-version: >=1.10
25cabal-version: >=1.10
26−tested-with: GHC ==7.6.3, GHC ==7.8.4, GHC ==8.0.1
26+tested-with: GHC ==7.6.3, GHC ==7.8.4, GHC ==8.0.2, GHC ==8.2.2, GHC ==8.4.1
27
27
28source-repository head
28source-repository head
29 type: git
29 type: git
@@ -38,12 +38,13 @@ library
38 GeneralizedNewtypeDeriving,
38 GeneralizedNewtypeDeriving,
39 DeriveTraversable,
39 DeriveTraversable,
40 DeriveDataTypeable
40 DeriveDataTypeable
41− build-depends: base >=4.5 && <4.11,
41+ build-depends: base >=4.5 && <4.12,
42 containers >=0.5 && <0.6,
42 containers >=0.5 && <0.6,
43 deepseq >=1.3 && <1.5,
43 deepseq >=1.3 && <1.5,
44 unordered-containers >= 0.2 && < 0.3,
44 unordered-containers >= 0.2 && < 0.3,
45 hashable >= 1.2 && < 1.3,
45 hashable >= 1.2 && < 1.3,
46 lens >=4.4 && <5,
46 lens >=4.4 && <5,
47− newtype >=0.2 && <0.3
47+ newtype >=0.2 && <0.3,
48+ semigroups >= 0.18 && < 0.19
48 hs-source-dirs: src
49 hs-source-dirs: src
49 default-language: Haskell2010
50 default-language: Haskell2010
src/Data/HashMap/Monoidal.hs+8−2
@@ -38,7 +38,7 @@ module Data.HashMap.Monoidal
38
38
39import Prelude hiding (lookup, map)
39import Prelude hiding (lookup, map)
40import Data.Maybe (fromMaybe)
40import Data.Maybe (fromMaybe)
41−import Data.Monoid
41+import Data.Semigroup
42import Data.Foldable (Foldable)
42import Data.Foldable (Foldable)
43import Control.Applicative (pure)
43import Control.Applicative (pure)
44import Data.Data (Data)
44import Data.Data (Data)
@@ -92,11 +92,17 @@ instance Wrapped (MonoidalHashMap k a) where
92 _Wrapped' = iso unpack pack
92 _Wrapped' = iso unpack pack
93 {-# INLINE _Wrapped' #-}
93 {-# INLINE _Wrapped' #-}
94
94
95+instance (Eq k, Hashable k, Semigroup a) => Semigroup (MonoidalHashMap k a) where
96+ MonoidalHashMap a <> MonoidalHashMap b = MonoidalHashMap $ M.unionWith (<>) a b
97+ {-# INLINE (<>) #-}
98+
95instance (Eq k, Hashable k, Monoid a) => Monoid (MonoidalHashMap k a) where
99instance (Eq k, Hashable k, Monoid a) => Monoid (MonoidalHashMap k a) where
96 mempty = MonoidalHashMap mempty
100 mempty = MonoidalHashMap mempty
97 {-# INLINE mempty #-}
101 {-# INLINE mempty #-}
102+#if !(MIN_VERSION_base(4,11,0))
98− MonoidalHashMap a `mappend` MonoidalHashMap b = MonoidalHashMap $ M.unionWith mappend a b
103+ mappend (MonoidalHashMap a) (MonoidalHashMap b) = MonoidalHashMap $ M.unionWith mappend a b
99 {-# INLINE mappend #-}
104 {-# INLINE mappend #-}
105+#endif
100
106
101instance Newtype (MonoidalHashMap k a) (M.HashMap k a) where
107instance Newtype (MonoidalHashMap k a) (M.HashMap k a) where
102 pack = MonoidalHashMap
108 pack = MonoidalHashMap
src/Data/Map/Monoidal.hs+8−2
@@ -28,7 +28,7 @@ module Data.Map.Monoidal
28 , keys
28 , keys
29 ) where
29 ) where
30
30
31−import Data.Monoid
31+import Data.Semigroup
32import Data.Foldable (Foldable)
32import Data.Foldable (Foldable)
33import Data.Traversable (Traversable)
33import Data.Traversable (Traversable)
34import Control.Applicative (Applicative, pure)
34import Control.Applicative (Applicative, pure)
@@ -89,11 +89,17 @@ instance Wrapped (MonoidalMap k a) where
89 _Wrapped' = iso unpack pack
89 _Wrapped' = iso unpack pack
90 {-# INLINE _Wrapped' #-}
90 {-# INLINE _Wrapped' #-}
91
91
92+instance (Ord k, Semigroup a) => Semigroup (MonoidalMap k a) where
93+ MonoidalMap a <> MonoidalMap b = MonoidalMap $ M.unionWith (<>) a b
94+ {-# INLINE (<>) #-}
95+
92instance (Ord k, Monoid a) => Monoid (MonoidalMap k a) where
96instance (Ord k, Monoid a) => Monoid (MonoidalMap k a) where
93 mempty = MonoidalMap mempty
97 mempty = MonoidalMap mempty
94 {-# INLINE mempty #-}
98 {-# INLINE mempty #-}
99+#if !(MIN_VERSION_base(4,11,0))
95− MonoidalMap a `mappend` MonoidalMap b = MonoidalMap $ M.unionWith mappend a b
100+ mappend (MonoidalMap a) (MonoidalMap b) = MonoidalMap $ M.unionWith mappend a b
96 {-# INLINE mappend #-}
101 {-# INLINE mappend #-}
102+#endif
97
103
98instance Newtype (MonoidalMap k a) (M.Map k a) where
104instance Newtype (MonoidalMap k a) (M.Map k a) where
99 pack = MonoidalMap
105 pack = MonoidalMap
src/Data/Map/Monoidal/Strict.hs+9−3
@@ -28,7 +28,7 @@ module Data.Map.Monoidal.Strict
28 , keys
28 , keys
29 ) where
29 ) where
30
30
31−import Data.Monoid
31+import Data.Semigroup
32import Data.Foldable (Foldable)
32import Data.Foldable (Foldable)
33import Data.Traversable (Traversable)
33import Data.Traversable (Traversable)
34import Control.Applicative (Applicative, pure)
34import Control.Applicative (Applicative, pure)
@@ -89,11 +89,17 @@ instance Wrapped (MonoidalMap k a) where
89 _Wrapped' = iso unpack pack
89 _Wrapped' = iso unpack pack
90 {-# INLINE _Wrapped' #-}
90 {-# INLINE _Wrapped' #-}
91
91
92+instance (Ord k, Semigroup a) => Semigroup (MonoidalMap k a) where
93+ MonoidalMap a <> MonoidalMap b = MonoidalMap $ M.unionWith (<>) a b
94+ {-# INLINE (<>) #-}
95+
92−instance (Ord k, Monoid a) => Monoid (MonoidalMap k a) where
96+instance (Ord k, Semigroup a, Monoid a) => Monoid (MonoidalMap k a) where
93 mempty = MonoidalMap mempty
97 mempty = MonoidalMap mempty
94 {-# INLINE mempty #-}
98 {-# INLINE mempty #-}
99+#if !(MIN_VERSION_base(4,11,0))
95− MonoidalMap a `mappend` MonoidalMap b = MonoidalMap $ M.unionWith mappend a b
100+ mappend (MonoidalMap a) (MonoidalMap b) = MonoidalMap $ M.unionWith mappend a b
96 {-# INLINE mappend #-}
101 {-# INLINE mappend #-}
102+#endif
97
103
98instance Newtype (MonoidalMap k a) (M.Map k a) where
104instance Newtype (MonoidalMap k a) (M.Map k a) where
99 pack = MonoidalMap
105 pack = MonoidalMap