approximate 0.3.1 → 0.3.2
raw patch · 6 files changed
+210/−91 lines, 6 filesdep ~safecopyPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: safecopy
API changes (from Hackage documentation)
- Data.Approximate.Mass: instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Data.Approximate.Mass.Mass a)
- Data.Approximate.Type: instance Data.Approximate.Type.HasApproximate (Data.Approximate.Type.Approximate a0) a0
+ Data.Approximate.Mass: instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Data.Approximate.Mass.Mass a)
+ Data.Approximate.Type: instance Data.Approximate.Type.HasApproximate (Data.Approximate.Type.Approximate a) a
- Data.Approximate.Mass: Mass :: {-# UNPACK #-} !(Log Double) -> a -> Mass a
+ Data.Approximate.Mass: Mass :: {-# UNPACK #-} !Log Double -> a -> Mass a
- Data.Approximate.Type: Approximate :: {-# UNPACK #-} !(Log Double) -> a -> Approximate a
+ Data.Approximate.Type: Approximate :: {-# UNPACK #-} !Log Double -> a -> Approximate a
- Data.Approximate.Type: approximate :: HasApproximate c_aq77 a_alZF => Lens' c_aq77 (Approximate a_alZF)
+ Data.Approximate.Type: approximate :: HasApproximate c_aqgp a_apPs => Lens' c_aqgp (Approximate a_apPs)
- Data.Approximate.Type: class HasApproximate c_aq77 a_alZF | c_aq77 -> a_alZF where confidence = (.) approximate confidence estimate = (.) approximate estimate hi = (.) approximate hi lo = (.) approximate lo
+ Data.Approximate.Type: class HasApproximate c_aqgp a_apPs | c_aqgp -> a_apPs
- Data.Approximate.Type: confidence :: HasApproximate c_aq77 a_alZF => Lens' c_aq77 (Log Double)
+ Data.Approximate.Type: confidence :: HasApproximate c_aqgp a_apPs => Lens' c_aqgp (Log Double)
- Data.Approximate.Type: estimate :: HasApproximate c_aq77 a_alZF => Lens' c_aq77 a_alZF
+ Data.Approximate.Type: estimate :: HasApproximate c_aqgp a_apPs => Lens' c_aqgp a_apPs
- Data.Approximate.Type: hi :: HasApproximate c_aq77 a_alZF => Lens' c_aq77 a_alZF
+ Data.Approximate.Type: hi :: HasApproximate c_aqgp a_apPs => Lens' c_aqgp a_apPs
- Data.Approximate.Type: lo :: HasApproximate c_aq77 a_alZF => Lens' c_aq77 a_alZF
+ Data.Approximate.Type: lo :: HasApproximate c_aqgp a_apPs => Lens' c_aqgp a_apPs
Files
- .gitignore +19/−0
- .travis.yml +161/−85
- CHANGELOG.markdown +4/−0
- approximate.cabal +12/−4
- src/Data/Approximate/Mass.hs +8/−1
- src/Data/Approximate/Type.hs +6/−1
.gitignore view
@@ -1,4 +1,5 @@ dist+dist-newstyle docs wiki TAGS@@ -11,3 +12,21 @@ *.hi *~ *#+.stack-work/+cabal-dev+*.chi+*.chs.h+*.dyn_o+*.dyn_hi+.hpc+.hsenv+.cabal-sandbox/+cabal.sandbox.config+*.prof+*.aux+*.hp+*.eventlog+cabal.project.local+cabal.project.local~+.HTF/+.ghc.environment.*
.travis.yml view
@@ -1,97 +1,173 @@-# This file has been generated -- see https://github.com/hvr/multi-ghc-travis+# This Travis job script has been generated by a script via+#+# haskell-ci '--output=.travis.yml' '--config=cabal.haskell-ci' 'cabal.project'+#+# For more information, see https://github.com/haskell-CI/haskell-ci+#+# version: 0.3.20190425+# language: c-sudo: false-+dist: xenial+git:+ # whether to recursively clone submodules+ submodules: false+notifications:+ irc:+ channels:+ - irc.freenode.org#haskell-lens+ skip_join: true+ template:+ - "\"\\x0313approximate\\x03/\\x0306%{branch}\\x03 \\x0314%{commit}\\x03 %{build_url} %{message}\"" cache: directories:- - $HOME/.cabsnap - $HOME/.cabal/packages-+ - $HOME/.cabal/store before_cache:- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar-+ - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log+ # remove files that are regenerated by 'cabal update'+ - rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*+ - rm -fv $CABALHOME/packages/hackage.haskell.org/*.json+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx+ - rm -rfv $CABALHOME/packages/head.hackage matrix: include:- # some doctests require type-level tricks, only in GHC >=7.8- - env: CABALVER=1.24 GHCVER=7.4.2 TEST=--disable-tests- compiler: ": #GHC 7.4.2"- addons: {apt: {packages: [cabal-install-1.24,ghc-7.4.2], sources: [hvr-ghc]}}- - env: CABALVER=1.24 GHCVER=7.6.3 TEST=--disable-tests- compiler: ": #GHC 7.6.3"- addons: {apt: {packages: [cabal-install-1.24,ghc-7.6.3], sources: [hvr-ghc]}}- - env: CABALVER=1.24 GHCVER=7.8.4- compiler: ": #GHC 7.8.4"- addons: {apt: {packages: [cabal-install-1.24,ghc-7.8.4], sources: [hvr-ghc]}}- - env: CABALVER=1.24 GHCVER=7.10.3- compiler: ": #GHC 7.10.3"- addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.3], sources: [hvr-ghc]}}- - env: CABALVER=1.24 GHCVER=8.0.2- compiler: ": #GHC 8.0.2"- addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2], sources: [hvr-ghc]}}-+ - compiler: ghc-8.8.1+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}}+ env: GHCHEAD=true+ - compiler: ghc-8.6.5+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-2.4"]}}+ - compiler: ghc-8.4.4+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-2.4"]}}+ - compiler: ghc-8.2.2+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-2.4"]}}+ - compiler: ghc-8.0.2+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-2.4"]}}+ - compiler: ghc-7.10.3+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.10.3","cabal-install-2.4"]}}+ - compiler: ghc-7.8.4+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.8.4","cabal-install-2.4"]}}+ - compiler: ghc-7.6.3+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.6.3","cabal-install-2.4"]}}+ - compiler: ghc-7.4.2+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.4.2","cabal-install-2.4"]}}+ - compiler: ghc-head+ addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-head","cabal-install-head"]}}+ env: GHCHEAD=true+ allow_failures:+ - compiler: ghc-head+ - compiler: ghc-8.8.1 before_install:- - unset CC- - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH- - TEST=${TEST---enable-tests}-+ - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')+ - HCPKG="$HC-pkg"+ - unset CC+ - CABAL=/opt/ghc/bin/cabal+ - CABALHOME=$HOME/.cabal+ - export PATH="$CABALHOME/bin:$PATH"+ - TOP=$(pwd)+ - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))+ - echo $HCNUMVER+ - CABAL="$CABAL -vnormal+nowrap+markoutput"+ - set -o pipefail+ - |+ echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk+ echo 'BEGIN { state = "output"; }' >> .colorful.awk+ echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk+ echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk+ echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk+ echo ' if (state == "cabal") {' >> .colorful.awk+ echo ' print blue($0)' >> .colorful.awk+ echo ' } else {' >> .colorful.awk+ echo ' print $0' >> .colorful.awk+ echo ' }' >> .colorful.awk+ echo '}' >> .colorful.awk+ - cat .colorful.awk+ - |+ color_cabal_output () {+ awk -f $TOP/.colorful.awk+ }+ - echo text | color_cabal_output install:- - cabal --version- - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"- - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];- then- zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >- $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;- fi- - travis_retry cabal update -v- - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config- - cabal install --only-dependencies $TEST --dry -v > installplan.txt- - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt--# check whether current requested install-plan matches cached package-db snapshot- - if diff -u $HOME/.cabsnap/installplan.txt installplan.txt;- then- echo "cabal build-cache HIT";- rm -rfv .ghc;- cp -a $HOME/.cabsnap/ghc $HOME/.ghc;- cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;- else- echo "cabal build-cache MISS";- rm -rf $HOME/.cabsnap;- mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;- cabal install -j --only-dependencies $TEST;- fi--# snapshot package-db on cache miss- - if [ ! -d $HOME/.cabsnap ];- then- echo "snapshotting package-db to build-cache";- mkdir $HOME/.cabsnap;- cp -a $HOME/.ghc $HOME/.cabsnap/ghc;- cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;- fi--# Here starts the actual work to be performed for the package under test;-# any command which exits with a non-zero exit code causes the build to fail.+ - ${CABAL} --version+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"+ - TEST=--enable-tests+ - if [ $HCNUMVER -lt 70800 ] ; then TEST=--disable-tests ; fi+ - BENCH=--enable-benchmarks+ - GHCHEAD=${GHCHEAD-false}+ - rm -f $CABALHOME/config+ - |+ echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config+ echo "remote-build-reporting: anonymous" >> $CABALHOME/config+ echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config+ echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config+ echo "world-file: $CABALHOME/world" >> $CABALHOME/config+ echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config+ echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config+ echo "installdir: $CABALHOME/bin" >> $CABALHOME/config+ echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config+ echo "store-dir: $CABALHOME/store" >> $CABALHOME/config+ echo "install-dirs user" >> $CABALHOME/config+ echo " prefix: $CABALHOME" >> $CABALHOME/config+ echo "repository hackage.haskell.org" >> $CABALHOME/config+ echo " url: http://hackage.haskell.org/" >> $CABALHOME/config+ - |+ if $GHCHEAD; then+ echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1/g')" >> $CABALHOME/config+ + echo "repository head.hackage" >> $CABALHOME/config+ echo " url: http://head.hackage.haskell.org/" >> $CABALHOME/config+ echo " secure: True" >> $CABALHOME/config+ echo " root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740" >> $CABALHOME/config+ echo " 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb" >> $CABALHOME/config+ echo " 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e" >> $CABALHOME/config+ echo " key-threshold: 3" >> $CABALHOME/config+ fi+ - cat $CABALHOME/config+ - rm -fv cabal.project cabal.project.local cabal.project.freeze+ - travis_retry ${CABAL} v2-update -v+ # Generate cabal.project+ - rm -rf cabal.project cabal.project.local cabal.project.freeze+ - touch cabal.project+ - |+ echo 'packages: "."' >> cabal.project+ - |+ echo "write-ghc-environment-files: always" >> cabal.project+ - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(approximate)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"+ - cat cabal.project || true+ - cat cabal.project.local || true+ - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi+ - ${CABAL} v2-freeze -w ${HC} ${TEST} ${BENCH} | color_cabal_output+ - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"+ - rm cabal.project.freeze+ - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all | color_cabal_output script:- - if [ -f configure.ac ]; then autoreconf -i; fi- - cabal configure $TEST -v2 # -v2 provides useful information for debugging- - cabal build # this builds all libraries and executables (including tests/benchmarks)- - if [ $TEST = "--enable-tests" ]; then cabal test; fi- - cabal sdist # tests that a source-distribution can be generated--# Check that the resulting source distribution can be built & installed.-# If there are no other `.tar.gz` files in `dist`, this can be even simpler:-# `cabal install --force-reinstalls dist/*-*.tar.gz`- - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&- (cd dist && cabal install --force-reinstalls "$SRC_TGZ")--notifications:- irc:- channels:- - "irc.freenode.org#haskell-lens"- skip_join: true- template:- - "\x0313approximate\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)+ # Packaging...+ - ${CABAL} v2-sdist all | color_cabal_output+ # Unpacking...+ - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/+ - cd ${DISTDIR} || false+ - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;+ # Generate cabal.project+ - rm -rf cabal.project cabal.project.local cabal.project.freeze+ - touch cabal.project+ - |+ echo 'packages: "approximate-*/*.cabal"' >> cabal.project+ - |+ echo "write-ghc-environment-files: always" >> cabal.project+ - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(approximate)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"+ - cat cabal.project || true+ - cat cabal.project.local || true+ # Building with tests and benchmarks...+ # build & run tests, build benchmarks+ - ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} all | color_cabal_output+ # Testing...+ - if [ $HCNUMVER -ge 70800 ] ; then ${CABAL} v2-test -w ${HC} ${TEST} ${BENCH} all | color_cabal_output ; fi+ # cabal check...+ - (cd approximate-* && ${CABAL} -vnormal check)+ # haddock...+ - if [ $HCNUMVER -lt 80200 ] || [ $HCNUMVER -ge 80400 ] ; then ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output ; fi +# REGENDATA ["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"] # EOF
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+0.3.2 [2019.09.13]+------------------+* Allow building with `safecopy-0.10`.+ 0.3.1 ----- * Add a library dependency on the `doctests` test suite
approximate.cabal view
@@ -1,6 +1,6 @@ name: approximate category: Numeric-version: 0.3.1+version: 0.3.2 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -11,7 +11,15 @@ bug-reports: http://github.com/analytics/approximate/issues copyright: Copyright (C) 2013 Edward A. Kmett build-type: Custom-tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2+tested-with: GHC == 7.4.2+ , GHC == 7.6.3+ , GHC == 7.8.4+ , GHC == 7.10.3+ , GHC == 8.0.2+ , GHC == 8.2.2+ , GHC == 8.4.4+ , GHC == 8.6.5+ , GHC == 8.8.1 synopsis: Approximate discrete values and numbers description: This package provides approximate discrete values and numbers. @@ -56,13 +64,13 @@ comonad >= 3 && < 6, deepseq >= 1.3 && < 1.5, ghc-prim,- hashable >= 1.2.5 && < 1.3,+ hashable >= 1.2.5 && < 1.4, lens >= 3.9 && < 5, log-domain, pointed >= 3 && < 6, semigroupoids >= 3.0.2 && < 6, semigroups >= 0.8.4 && < 1,- safecopy >= 0.8.1 && < 0.10,+ safecopy >= 0.8.1 && < 0.11, vector >= 0.9 && < 0.13 if flag(herbie)
src/Data/Approximate/Mass.hs view
@@ -36,7 +36,9 @@ import Data.Hashable.Lifted (Hashable1(..)) import Data.Pointed import Data.SafeCopy+#if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup+#endif import Data.Serialize as Serialize #if __GLASGOW_HASKELL__ < 710 import Data.Traversable@@ -74,7 +76,12 @@ put (Mass p a) = Serialize.put p >> Serialize.put a get = Mass <$> Serialize.get <*> Serialize.get -instance Serialize a => SafeCopy (Mass a)+instance Serialize a => SafeCopy (Mass a) where+ -- safecopy-0.10.0 changed its default implementations for these methods.+ -- The implementations below are copied from the pre-0.10.0 defaults.+ errorTypeName _ = "<unknown type>"+ getCopy = contain Serialize.get+ putCopy = contain . Serialize.put instance Hashable a => Hashable (Mass a) instance Hashable1 Mass where
src/Data/Approximate/Type.hs view
@@ -66,7 +66,12 @@ put (Approximate p l m h) = Serialize.put p >> Serialize.put l >> Serialize.put m >> Serialize.put h get = Approximate <$> Serialize.get <*> Serialize.get <*> Serialize.get <*> Serialize.get -instance Serialize a => SafeCopy (Approximate a)+instance Serialize a => SafeCopy (Approximate a) where+ -- safecopy-0.10.0 changed its default implementations for these methods.+ -- The implementations below are copied from the pre-0.10.0 defaults.+ errorTypeName _ = "<unknown type>"+ getCopy = contain Serialize.get+ putCopy = contain . Serialize.put instance Hashable a => Hashable (Approximate a) instance Hashable1 Approximate where